public override void Execute() { NWCreature self = (NWCreature)Self; ExtPoint iPos = Position; if (self.IsSeen(iPos.X, iPos.Y, true) && !(self.CurrentMap.FindItem(iPos.X, iPos.Y) is Item)) { IsComplete = true; } else { if (MathHelper.Distance(self.Location, iPos) == 0) { self.PickupAll(); IsComplete = true; } else { ExtPoint next = self.GetStep(iPos); if (!next.IsEmpty) { Brain.StepTo(next.X, next.Y); } else { IsComplete = true; } } } }
public override bool IsAwareOfEmitter(Emitter emitter) { NWCreature iSelf = (NWCreature)fSelf; ExtPoint ePos = emitter.Position; bool result = false; switch (emitter.EmitterKind) { case EmitterKind.ek_Unknown: { break; } case EmitterKind.ek_Damaged: { result = (emitter.SourceID == fSelf.UID); break; } case EmitterKind.ek_Combat: case EmitterKind.ek_BloodSpatter: case EmitterKind.ek_DeadBody: case EmitterKind.ek_Creature: case EmitterKind.ek_Item: case EmitterKind.ek_AngryTownsman: case EmitterKind.ek_UpsetTownsman: { result = (emitter.SourceID != fSelf.UID && iSelf.IsSeen(ePos.X, ePos.Y, true)); break; } case EmitterKind.ek_BattleSounds: case EmitterKind.ek_Missile: case EmitterKind.ek_GuardAlarm: case EmitterKind.ek_Call: { result = (emitter.SourceID != fSelf.UID && MathHelper.Distance(fSelf.Location, ePos) < (int)((NWCreature)iSelf).Hear); break; } default: { Logger.Write("BeastBrain.isAwareOfEmitter(): Emitter not recognized: " + Convert.ToString((int)emitter.EmitterKind)); result = false; break; } } return(result); }