diff --git a/as2/ex2/archer.cpp b/as2/ex2/archer.cpp index 3625cee..c1b860a 100644 --- a/as2/ex2/archer.cpp +++ b/as2/ex2/archer.cpp @@ -24,7 +24,7 @@ archer::archer(int lv_in, string name_in) playerdeath=0; EXP=LV*LV*75; - bag.set(lv_in, lv_in); + bag.set(lv_in*(rand()%2), lv_in*(rand()%2)); } void archer::isLevelUp() @@ -37,7 +37,9 @@ void archer::isLevelUp() HPmax+=8; MPmax+=2; speed+=2; + bag.set(bag.nOfHeal()+LV, bag.nOfMW()+LV); cout<p.speed) && (rand()%100<(speed-p.speed))) // rand()%100 means generates a number no greater than 100 { - HPtemp=(int)((1.0*AP/p.DP)*AP*5/(rand()%4+10)); // opponent's HP decrement calculated based their AP/DP, and uncertain chance + HPtemp=(int)((attack)*AP*5/(rand()%4+10)); // opponent's HP decrement calculated based their AP/DP, and uncertain chance cout< + cout< + } - // Normal attack - HPtemp=(int)((1.0*AP/p.DP)*AP*5/(rand()%4+10)); - cout< + cout< +//--> EXPtemp=(int)(HPtemp*1.5); // special attack provides more experience - cout<p.speed) && (rand()%100<(speed-p.speed))) // rand()%100 means generates a number no greater than 100 { - HPtemp=(int)((1.0*AP/p.DP)*AP*5/(rand()%4+10)); // opponent's HP decrement calculated based their AP/DP, and uncertain chance + HPtemp=(int)((attack)*AP*5/(rand()%4+10)); // opponent's HP decrement calculated based their AP/DP, and uncertain chance cout< + cout< + } - // Normal attack - HPtemp=(int)((1.0*AP/p.DP)*AP*5/(rand()%4+10)); - cout< + cout< EXPtemp=(int)(HPtemp*1.5); // special attack provides more experience - cout<=LV*LV*75) - { - LV++; - AP+=4; - DP+=4; - HPmax+=8; - MPmax+=2; - speed+=2; - cout<=LV*LV*75) + { + LV++; + AP+=4; + DP+=4; + HPmax+=8; + MPmax+=2; + speed+=2; + bag.set(bag.nOfHeal()+LV, bag.nOfMW()+LV); + cout<p.speed) && (rand()%100<(speed-p.speed))) // rand()%100 means generates a number no greater than 100 - { - HPtemp=(int)((1.0*AP/p.DP)*AP*5/(rand()%4+10)); // opponent's HP decrement calculated based their AP/DP, and uncertain chance - cout<p.speed) && (rand()%100<(speed-p.speed))) // rand()%100 means generates a number no greater than 100 + { + HPtemp=(int)((attack)*AP*5/(rand()%4+10)); // opponent's HP decrement calculated based their AP/DP, and uncertain chance + cout< + cout< - // Normal attack - HPtemp=(int)((1.0*AP/p.DP)*AP*5/(rand()%4+10)); - cout< - cout< - system("pause"); - return 1; // Attack success + system("pause"); + return 1; // Attack success } bool swordsman::specialatt(player &p) { - if(MP<40) - { - cout<<"You don't have enough magic points!"< - system("pause"); - } - return 1; // special attack succeed + if(MP<40) + { + cout<<"You don't have enough magic points!"< + EXPtemp=(int)(HPtemp*1.5); // special attack provides more experience + cout<