Esempio n. 1
0
 private bool calculateIsPlayerFirst(IBattleCommand playerCommand)
 {
     if (playerCommand.Type != BattleCommandType.Attack)
     {
         //playerCommand is run, pokechange, or item and has priority
         return(true);
     }
     else //player is attacking
     {
         if (oppCommand.Type != BattleCommandType.Attack)
         {
             //oppCommand is run,pokeChange,item and has priority
             return(false);
         }
         else //both are attacking
         {
             //!add priority attack check
             if (player.CurrentPokemon.battleSpeed >
                 opponent.CurrentPokemon.battleSpeed)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
 }
Esempio n. 2
0
        private void setUpTurn(IBattleCommand playerCommand)
        {
            fAssert.assert(state == BattleState.BattleSetUpComplete ||
                           state == BattleState.TurnComplete,
                           "Trying to set up a turn in an invalid state");

            this.playerCommand = playerCommand;
            oppCommand         = opponent.getNextCombatCommand();

            pokemonBattleManager.calculateDynamicAttributes(player.CurrentPokemon);
            pokemonBattleManager.calculateDynamicAttributes(opponent.CurrentPokemon);

            state = BattleState.TurnSetUpComplete;

            Fi.logs.logMessage("Turn set-up");
        }
Esempio n. 3
0
        private Button GetButton(IBattleCommand cmd)
        {
            Button btn;
            if (!buttons.TryGetValue(cmd, out btn))
            {
                // クリックしたときに実行されるコマンド
                // 作成されるボタン
                btn = new Button {
                    Margin = new Padding(0),
                    Size = new Size(48, 48),
                    Image = cmd.Image,
                    Text = cmd.Image == null ? cmd.Name : "",
                };
                buttons[cmd] = btn;
                // マウスオーバーで表示される文字
                toolTip.SetToolTip(btn, cmd.Description);
                // クリック時のイベントを設定
                btn.Click += delegate {
                    flowLayoutPanel.Enabled = false;
                    var doer = Situation.ActiveUnit;

                    // キャンセル時の処理はGUIの実装に依存するためここに記述
                    Action finished = () => {
                        doer.ChangeCommandState(cmd);
                        ResetCommandButtons();
                        flowLayoutPanel.Enabled = true;
                    };
                    model.CancelCommandStack.Push(() => {
                        ResetCommandButtons();
                        flowLayoutPanel.Enabled = true;
                        return true; // キャンセル処理の完了
                    });
                    var arc = new ActionArguments(Situation, model);
                    cmd.Execute(arc, doer, finished);
                };
            }
            return btn;
        }
Esempio n. 4
0
 public CommandInfo(IBattleCommand command, bool enable)
 {
     Command = command;
     Enable = enable;
 }
Esempio n. 5
0
 public CommandInfo(IBattleCommand command)
     : this(command, true)
 {
 }
Esempio n. 6
0
 public void ChangeCommandState(IBattleCommand cmd)
 {
     _commandState = _commandState.Transition[cmd];
 }