public MenuActionState(IGameAction gameAction, int creatureId, FDPosition position) : base(gameAction, position) { this.CreatureId = creatureId; this.Creature = gameAction.GetCreature(creatureId); // Magic this.SetMenu(0, MenuItemId.ActionMagic, IsMenuMagicEnabled(), () => { CreatureShowInfoPack pack = new CreatureShowInfoPack(this.Creature, CreatureInfoType.SelectMagic); gameAction.GetCallback().OnHandlePack(pack); subState = SubActionState.SelectMagic; return(StateOperationResult.None()); }); // Attack this.SetMenu(1, MenuItemId.ActionAttack, IsMenuAttackEnabled(), () => { SelectAttackTargetState attackState = new SelectAttackTargetState(gameAction, this.Creature); return(StateOperationResult.Push(attackState)); }); // Item this.SetMenu(2, MenuItemId.ActionItems, IsMenuItemEnabled(), () => { MenuItemState itemState = new MenuItemState(gameAction, this.CreatureId, this.Central); return(StateOperationResult.Push(itemState)); }); // Rest this.SetMenu(3, MenuItemId.ActionRest, true, () => { // Check Treasure treasureItem = gameAction.GetTreatureAt(this.Creature.Position); if (treasureItem != null) { subState = SubActionState.ConfirmPickTreasure; return(StateOperationResult.None()); } gameAction.DoCreatureRest(this.CreatureId); return(StateOperationResult.Clear()); }); }