Untitled

 avatar
unknown
plain_text
a year ago
3.2 kB
8
Indexable
#include <iostream>

using namespace std;

void printInfoHero(int HP_HERO, int LEVEL_HERO, int PHOENIX, int EXCALIBUR, int POTION, int MAXHP){
    cout<<"THONG TIN HIEP SI:";
    cout<<endl;
    cout<<"-----";
    cout<<endl;
    bool newExcalibur = false;
    if (EXCALIBUR == 1){
        newExcalibur = true;
    }
    else newExcalibur = false;
    cout<<"HEALTH: <"<<HP_HERO<<"> "<<"LEVEL: <"<<LEVEL_HERO<<"> "<<"PHOENIX: <"<<PHOENIX<<"> "<<"POTION: <"<<POTION<<"> "<<"EXCALIBUR: <"<<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;
}

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){
        MAXHP = 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
    string NAME, PRINCESS;
    int MAXHP, HP_HERO, LEVEL_HERO, PHOENIX, EXCALIBUR, POTION;
	cout<<"TEN HIEP SI: ";
	getline(cin, NAME);
	cout<<"TEN CONG CHUA: ";
	getline(cin, PRINCESS);
    cout<<"HP: ";
    cin>>MAXHP;
    cout<<"LEVEL: ";
    cin>>LEVEL_HERO;
    cout<<"PHOENIX: ";
    cin>>PHOENIX;
    cout<<"POTION: ";
    cin>>POTION;
    cout<<"EXCALIBUR: ";
    cin>>EXCALIBUR;
    
    int n;
    cout<<"AMOUNT OF DUNGEON HAVE TO OVERCOME: ";
    cin>>n;
    while (n > 0){
        int ID, LEVEL_ENEMY;
        cout<<"ID: ";
        cin>>ID;
        cout<<"LEVEL ENEMY: ";
		cin>>LEVEL_ENEMY;
        event(ID, LEVEL_ENEMY, HP_HERO, LEVEL_HERO);
        n--;
    }
    cout<<endl;
    printInfoHero(HP_HERO, LEVEL_HERO, PHOENIX, POTION, EXCALIBUR, MAXHP);
    
    //result
    if (HP_HERO > 0){
        cout<<NAME<<" DA GIAI CUU DUOC "<<PRINCESS<<"... TU DO, "<<NAME<<" VA "<<PRINCESS<<" HANH PHUC BEN NHAU";
    }
    else {
        cout<<NAME<<" DA DANH MAT "<<PRINCESS<<" MAI MAI...";
    }
    return 0;
}
Editor is loading...
Leave a Comment