public bool IsCommandPossible(BattleCardMaid maid, CommandMaid.State cmd) { if (cmd == CommandMaid.State.TurnEnd) { return(currentTurn == Turn.Self); } if (maid == null || cmd == CommandMaid.State.None) { return(false); } if (cmd == CommandMaid.State.Cancel) { return(true); } return(events.Count == 0 && currentTurn == maid.Owner.Side); }
public void SetCommand(int idx, CommandMaid.State cmd, bool clickable = true) { commands[idx].SetCommand(cmd, clickable); }
public void CommandExecute(BattleCardMaid maid, CommandMaid.State cmd) { if (maid == null) { maid = CurrentSelectedCard; } if (!IsCommandPossible(maid, cmd)) { return; } switch (cmd) { case CommandMaid.State.TurnEnd: AddBattleEvent(new TurnEndBattleEvent()); break; case CommandMaid.State.Cancel: { if (currentCmd == CommandMaid.State.Attacking) { Helper.SetText("攻擊取消。"); } else if (currentCmd == CommandMaid.State.Casting) { Helper.SetText("施法取消。"); } ClearCurrentCommand(); ClearSetTargetable(); break; } case CommandMaid.State.Attack: currentCmd = CommandMaid.State.Attacking; AddBattleEvent(new AttackBattleEvent(maid)); Helper.SetText("請選擇攻擊目標:"); break; case CommandMaid.State.Cast: currentCmd = CommandMaid.State.Casting; SpellCardData s = maid.Data as SpellCardData; AddBattleEvent(new CastSpellBattleEvent(s.CastEffect, maid)); Helper.SetText("請選擇施法目標:"); break; case CommandMaid.State.Summon: maid.Owner.SummonCard(maid); MonsterCardData m = maid.Data as MonsterCardData; if (m.Warcry != null) { AddBattleEvent(new AbilityBattleEvent(m.Warcry, maid)); } break; } if (maid != null) { maid.Owner.UpdateState(); if (maid == CurrentSelectedCard) { SetCommand(maid); } } }
public void ClearCurrentCommand() { currentCmd = CommandMaid.State.None; }