Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
2.6 kB
5
Indexable
Never
#include <iostream>

using namespace std;

void printInfoHero(int HP_HERO, int LEVEL_HERO, int PHOENIX, int EXCALIBUR, int POTION){
    cout<<"THONG TIN HIEP SI:";
    cout<<endl;
    cout<<"-----";
    cout<<endl;
    bool newExcalibur = false;
    if (EXCALIBUR == 1){
        newExcalibur = true;
    }
    else newExcalibur = false;
    cout<<HP_HERO<<LEVEL_HERO<<PHOENIX<<POTION<<newExcalibur<<endl;
    
    cout<<"THONG TIN TUI DO:";
    cout<<endl;
    cout<<"-----";
    cout<<endl;
    cout<<"PHOENIX: "<<PHOENIX;
    cout<<endl;
    cout<<"POTION:" <<POTION;
    cout<<endl;
    cout<<"EXCALIBUR: "<<newExcalibur;
    cout<<endl;2
}

void combat(int HP_HERO, int LEVEL_HERO, int PHOENIX, int HP_ENEMY, int DMG, int MAXHP){
    if (DMG > HP_ENEMY){
        LEVEL_HERO = LEVEL_HERO + 1;
    }
    else if (DMG < HP_ENEMY){
        HP_HERO = HP_ENEMY;
        if (HP_HERO < 0){
            HP_HERO == 0;
        }
        else if (HP_HERO == 0){
            if (PHOENIX > 0){
                HP_HERO = MAXHP;
                PHOENIX = PHOENIX - 1;
            }
        }
    }
}

//event
void event(int ID, int LEVEL_ENEMY, int HP_HERO, int LEVEL_HERO){
        if (ID == 1){
            cout<<"GOBLIN SLAYER";
            int baseHpGoblin = 5;
            int HP_ENEMY = baseHpGoblin * LEVEL_ENEMY;
            int baseDMG = HP_HERO / 20;
            int DMG = (baseDMG * LEVEL_HERO) % 11;
            cout<<endl;
        }
        else if (ID == 2){
            cout<<"Kill the Slime";
            int baseHpGoblin = 15;
            int HP_ENEMY = baseHpGoblin * LEVEL_ENEMY;
            int baseDMG = HP_HERO / 20;
            int DMG = (baseDMG * LEVEL_HERO) % 11;
            cout<<endl;
        }
        else if (ID == 3){
            cout<<"Big Bear";
            int baseHpGoblin = 20;
            int HP_ENEMY = baseHpGoblin * LEVEL_ENEMY;
            int baseDMG = HP_HERO / 20;
            int DMG = (baseDMG * LEVEL_HERO) % 11;
        }
    }

int main(){
    //input
    int MAXHP, HP_HERO, LEVEL_HERO, PHOENIX, EXCALIBUR, POTION;
    cin>>MAXHP>>LEVEL_HERO>>PHOENIX>>POTION>>EXCALIBUR;
    
    int n;
    cin>>n;
    while (n > 0){
        int ID, LEVEL_ENEMY;
        cin>>ID
        event(ID, LEVEL_ENEMY, HP_HERO, LEVEL_HERO);
        n--;
    }
    
    printInfoHero(HP_HERO, LEVEL_HERO, PHOENIX, POTION, EXCALIBUR);
    
    if (HP_HERO > 0){
        cout<<"THE PRINCESS HAS BEEN SAVED!";
    }
    else {
        cout<<"THE PRINCESS HAS BEEEN TRAPPED FOREVER!";
    }

    

    return 0;
}
Leave a Comment