public override void Fight(Entity_303 target) { if (Health <= 0) { return; } int damage = GetDamage(); target.Health -= damage; Console.WriteLine(GetName() + "attacks! " + target.GetName() + " takes " + damage); }
public void BegainRound() { for (int i = 0; i < _goodMonsters.Length; i++) { Entity_303 currentMonster = _goodMonsters[i]; currentMonster.Fight(_badMonsters); } for (int i = 0; i < _badMonsters.Length; i++) { Entity_303 currentMonster = _badMonsters[i]; currentMonster.Fight(_goodMonsters); } }
public void Print() { //The good monsters for (int i = 0; i < _goodMonsters.Length; i++) { Entity_303 currentMonster = _goodMonsters[i]; currentMonster.Print(); } //The bad monsters for (int i = 0; i < _badMonsters.Length; i++) { Entity_303 currentMonster = _badMonsters[i]; currentMonster.Print(); } }
public void Start() { Console.WriteLine("\n Begain!!!"); bool stillFighting = true; while (stillFighting) { //check if team 1 is alive bool goodIsAlive = true; bool badIsAlive = true; for (int i = 0; i < _goodMonsters.Length; i++) { Entity_303 currentMonster = _goodMonsters[i]; if (currentMonster.Health > 0) { /*our team is alive and not dead, break out * of the loop*/ goodIsAlive = true; break; } else if (currentMonster.Health <= 0) { //our team may be dead goodIsAlive = false; } } //check if team2 is alive bool team2 = true; int totalBadHealth = 0; for (int i = 0; i < _badMonsters.Length; i++) { Entity_303 currentMonster = _badMonsters[i]; //Total up the health of each monster on this team totalBadHealth += currentMonster.Health; badIsAlive = totalBadHealth > 0; } if (goodIsAlive && badIsAlive) { stillFighting = true; BegainRound(); } else { stillFighting = false; if (goodIsAlive) { foreach (Entity_303 cr in _goodMonsters) { if (cr is Character) { Character ch = (Character)cr; ch.Experience += GetTotalXP(_badMonsters); } } } else if (badIsAlive) { foreach (Entity_303 cr in _badMonsters) { if (cr is Character) { Character ch = (Character)cr; ch.Experience += GetTotalXP(_goodMonsters); } } } } Print(); } }
public virtual void Fight(Entity_303 target) { }