private Character getTarget(Party goodGuys) { /* start getTarget */ Character target = goodGuys.getCharacter(0); int i; for (i = 0; i < goodGuys.Size; i++) if (goodGuys.getCharacter(i).CurrentHealth < target.CurrentHealth) target = goodGuys.getCharacter(i); return target; }
public override BattleAction ai(Party goodGuys) { /* start ai */ Random random = new Random(); int target = random.Next( goodGuys.Size ); return new AttackAction(goodGuys.getCharacter(target)); }
public override BattleAction ai(Party goodGuys) { /* start ai */ Random random = new Random(); int i; Character target = null; /* Should modularize these loops */ for (i = 0; i < goodGuys.Size; i++) if (((PlayerCharacter)goodGuys.getCharacter(i)).Class == ClassEnum.WHITEMAGE) target = goodGuys.getCharacter(i); if( target == null ) for (i = 0; i < goodGuys.Size; i++) if (((PlayerCharacter)goodGuys.getCharacter(i)).Class == ClassEnum.REDMAGE) target = goodGuys.getCharacter(i); if (target == null) target = goodGuys.getCharacter(random.Next(Party.MAXPARTY)); return new AttackAction(target); }