public void Perform()
        {
            _v.Target.Flags   |= CalcFlag.HpAlteration;
            _v.Target.HpDamage = (Int16)Math.Min(9999, _v.Target.MaximumHp - _v.Target.CurrentHp);

            foreach (BattleUnit unit in BattleState.EnumerateUnits())
            {
                _v.Target.Change(unit);

                if (!_v.Target.IsPlayer && _v.Target.IsSelected)
                {
                    SBattleCalculator.CalcResult(_v);
                    BattleState.Unit2DReq(unit);
                }
            }
        }
示例#2
0
        public void Perform()
        {
            if (!_v.Target.CanBeHealed())
            {
                return;
            }

            _v.Caster.Flags    = CalcFlag.MpAlteration | CalcFlag.MpRecovery;
            _v.Caster.MpDamage = (Int16)(GameRandom.Next16() % (_v.Target.Level * 2));

            foreach (BattleUnit unit in BattleState.EnumerateUnits())
            {
                if (!unit.IsPlayer || !unit.IsSelected)
                {
                    continue;
                }

                _v.Caster.Change(unit);
                SBattleCalculator.CalcResult(_v);
                BattleState.Unit2DReq(unit);
            }
        }
示例#3
0
        public void Perform()
        {
            const BattleStatus cannotAttack = BattleStatus.Stone | BattleStatus.Poison2 | BattleStatus.Disable | BattleStatus.Confu | BattleStatus.Berserk
                                              | BattleStatus.Stop | BattleStatus.Sleep | BattleStatus.Freeze | BattleStatus.Jump;

            _v.Context.Flags = (BattleCalcFlags)BattleState.GetUnitIdsUnderStatus(false, BattleStatus.Dying);
            if (_v.Context.Flags == 0)
            {
                UiState.SetBattleFollowFormatMessage(BattleMesages.ChargeFailed);
                return;
            }

            Boolean canAttack = false;

            foreach (BattleUnit unit in BattleState.EnumerateUnits())
            {
                if (((BattleCalcFlags)unit.Id & _v.Context.Flags) == 0 || unit.IsUnderStatus(cannotAttack))
                {
                    continue;
                }

                canAttack = true;
                UInt16 randomEnemy = BattleState.GetRandomUnitId(isPlayer: false);
                if (randomEnemy == 0)
                {
                    return;
                }

                BattleState.EnqueueConter(unit, (BattleCommandId)52, BattleAbilityId.Attack, randomEnemy);
            }

            if (canAttack == false)
            {
                _v.Context.Flags = 0;
                UiState.SetBattleFollowFormatMessage(BattleMesages.ChargeFailed);
            }
        }