void Warrior::Minute_10(bool If_arrive) { ++Step; if (name == iceman and !(Step % 2)) { if (Life < 10) Life = 1; else Life -= 9; Attack += 20; } Print_time(); cout << Command_Belong_to->colour(true) << ' ' << Knight[name] << ' ' << Num; if (If_arrive) cout << " reached " << Command_Belong_to->colour(false) << " headquarter"; else cout << " marched to city " << City_Belong_to->Num(); cout << " with " << Life << " elements and force " << Attack << endl; }
void Warrior::Fight(Warrior *Wp) { Warrior *Wp_win = NULL; Warrior *Wp_lose = NULL; l_life = Life; Wp->l_life = Wp->Life; if (Life > 0 and (Wp->Life) > 0) { int swatk = 0; if (weapon[sword]) swatk = weapon[sword]->sw_atk(); Print_time(); cout << Command_Belong_to->colour(true) << ' ' << Knight[name] << ' ' << Num << " attacked " << (Wp->Command_Belong_to)->colour(true) << ' ' << Knight[Wp->name] << ' ' << Wp->Num << " in city " << City_Belong_to->Num() << " with " << Life << " elements and force " << Attack << endl; Wp->Life = Wp->Life - Attack - swatk; if (swatk) if (!weapon[sword]->sword_dull()) { delete weapon[sword]; weapon[sword] = NULL; } if (Wp->Life > 0) { if (Wp->name == ninja) { City_Belong_to->Flag_Set(-1); Morale_Change(); Loyal_Reduce(); } else { int E_swatk = 0; if (Wp->weapon[sword]) E_swatk = (Wp->weapon[sword])->sw_atk(); Print_time(); cout << (Wp->Command_Belong_to)->colour(true) << ' ' << Knight[Wp->name] << ' ' << Wp->Num << " fought back against " << Command_Belong_to->colour(true) << ' ' << Knight[name] << ' ' << Num << " in city " << City_Belong_to->Num() <<endl; Life = Life - (Wp->Attack / 2) - E_swatk; if (E_swatk) if(!(Wp->weapon[sword])->sword_dull()) { delete Wp->weapon[sword]; Wp->weapon[sword] = NULL; } if (Life > 0) { City_Belong_to->Flag_Set(-1); Morale_Change(); Wp->Morale_Change(); Loyal_Reduce(); Wp->Loyal_Reduce(); } else { Wp->If_kill = true; Wp_lose = this; Wp_win = Wp; } } } else { If_kill = true; Wp_win = this; Wp_lose = Wp; } } else { if (Life > 0) { Wp->l_life = 0; Wp_win = this; Wp_lose = Wp; } else { l_life = 0; Wp_lose = this; Wp_win = Wp; } } if (Wp_win) { Wp_win->account(Wp_lose); } if (name == dragon and Life > 0 and Morale > 0.8) { Print_time(); cout << Command_Belong_to->colour(true) << ' ' << Knight[name] << ' ' << Num << " yelled in city " << City_Belong_to->Num() << endl; } if (Wp_win) { Print_time(); cout << (Wp_win->Command_Belong_to)->colour(true) << ' ' << Knight[Wp_win->name] << ' ' << Wp_win->Num << " earned " << City_Belong_to->Life_() << " elements for his headquarter\n"; (Wp_win->City_Belong_to)->Flag_Set((Wp_win->Command_Belong_to)->colour()); } }
void Warrior::Dead() { Print_time(); cout << Command_Belong_to->colour(true) << ' ' << Knight[name] << ' ' << Num << " was killed in city " << City_Belong_to->Num() << endl; }