public override void Execute() { NWCreature self = (NWCreature)Self; bool ex = (self.CurrentField).Creatures.IndexOf(Enemy) >= 0; if (ex) { if (!CanMove) { Brain.Attack(Enemy, true); } else { int chn = RandomHelper.GetRandom(5); // 20% chance if (chn == 0) { if (Risk == AttackRisk.Evade) { Brain.Attack(Enemy, true); } } else { ExtPoint res = Brain.GetEvadePos(Enemy); if (!res.IsEmpty) { Brain.StepTo(res.X, res.Y); } } } } IsComplete = (!ex || !self.IsAvailable(Enemy, true)); }
public override void Execute() { NWCreature self = (NWCreature)Self; NWCreature enemy = (NWCreature)Enemy; bool ex = ((NWField)self.CurrentMap).Creatures.IndexOf(enemy) >= 0; RaceID race = self.Entry.Race; bool los = (race == RaceID.crDefault || race == RaceID.crHuman); IsComplete = (!ex || enemy.State == CreatureState.csDead || !self.IsAvailable(enemy, los)); if (!IsComplete) { if (!CanMove) { Brain.Attack(enemy, true); } else { Brain.Attack(enemy, Risk == AttackRisk.ar_Wary); } IsComplete = (enemy.State == CreatureState.csDead); } }