Пример #1
0
        //DEPRECATED

        /*
         * public static void attackNearestPlayer(GameCharacter enemy, BattleGame game)
         * {
         *
         *  var attackTarget= getAttackablePlayer(enemy,game);
         *  if (attackTarget != null)
         *  {
         *      attackPlayer(enemy, attackTarget, game);
         *  }
         *  else
         *  {
         *      var moveTarget = findNearestPlayer(enemy, game.board, game.characterList);
         *      moveToPlayer(enemy, moveTarget, game.board);
         *  }
         *
         * }
         * */

        //DEPRECATED
        private static void attackPlayer(GameCharacter enemy, GameCharacter player, BattleGame game)
        {
            if (enemy.SpendAP(enemy.weapon.actionPoints))
            {
                CombatHelper.Attack(enemy, player, game);
            }
        }
Пример #2
0
        private bool Attack(GameCharacter character, Tile targetTile)
        {
            if (!CoreHelper.checkEffect(character.activeEffects, character.passiveEffects, StatType.Stun))
            {
                GameCharacter target = getCharacterFromTile(targetTile);
                if (target != null)
                {
                    if (character.weapon != null)
                    {
                        if (character.SpendAP(character.weapon.actionPoints))
                        {
                            return(CombatHelper.Attack(character, target, this));
                        }
                    }
                }
            }
            else
            {
                battleLog.AddEntry(string.Format("{0} is stunned and unable attack.", character.name));
            }

            return(false);
        }