public void Execute(IActor actor, ITrigger trigger = null) { if (!actor.IsDead() && !actor.InCombat) { //Will stay in place until forced into combat or a script puts it in another state ((NPC)actor).NextAiAction = DateTime.Now.AddSeconds(5).ToUniversalTime(); } if (actor.InCombat) { ((NPC)actor).Fsm.ChangeState(Combat.GetState(), actor); } }
public void Execute(IActor actor, ITrigger trigger = null) { if (!actor.IsDead() && !actor.InCombat) { if (DateTime.Now.ToUniversalTime() > ((NPC)actor).NextAiAction) { //eventually these literals will be retrieved from the literals table for each different NPC Commands.CommandParser.ExecuteCommand(actor, "SAY", "brains..."); Commands.CommandParser.ExecuteCommand(actor, "EMOTE", "reaches out attempting to grab something"); ((NPC)actor).NextAiAction = DateTime.Now.AddSeconds(RandomNumber.GetRandomNumber().NextNumber(15, 60)).ToUniversalTime(); if (!FSM.ContinueWithThisState()) { ((NPC)actor).Fsm.ChangeState(Wander.GetState(), actor); } } } }
public void Execute(IActor actor, ITrigger trigger = null) { if (!actor.IsDead() && !actor.InCombat) { IRoom room = Room.GetRoom(actor.Location); room.GetRoomExits(); var availableExits = room.RoomExits; if (DateTime.Now.ToUniversalTime() > ((NPC)actor).NextAiAction) {//so it's time for this AI state to execute Commands.CommandParser.ExecuteCommand(actor, availableExits[RandomNumber.GetRandomNumber().NextNumber(0, availableExits.Count)].Direction); ((NPC)actor).NextAiAction = DateTime.Now.AddSeconds(RandomNumber.GetRandomNumber().NextNumber(60, 121)).ToUniversalTime(); //set when we want this action to execute next if (!FSM.ContinueWithThisState()) { ((NPC)actor).Fsm.ChangeState(Speak.GetState(), actor); } } } if (actor.InCombat) { ((NPC)actor).Fsm.ChangeState(Combat.GetState(), actor); } }