public void Perform() { MutableBattleCommand command = CreateCommand(); Byte scriptId = PrepareCommand(command); SBattleCalculator.Calc(_v.Caster, _v.Target, command, scriptId); }
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); } } }
public void Perform() { if (!_v.CheckHasCommandItem()) { return; } Byte itemId = _v.Command.Power; BattleItem item = BattleItem.Find(itemId); Byte itemScript = item.ScriptId; MutableBattleCommand itemCommand = new MutableBattleCommand(); itemCommand.Id = BattleCommandId.Item; itemCommand.AbilityId = BattleAbilityId.Void; itemCommand.LoadAbility(); itemCommand.AbilityId = (BattleAbilityId)itemId; SBattleCalculator.Calc(_v.Caster, _v.Target, itemCommand, itemScript); BattleItem.RemoveFromInventory(itemId); }
public static void CheckEscape(Boolean calc_check) { FF9StateBattleSystem ff9Battle = FF9StateSystem.Battle.FF9Battle; if ((ff9Battle.cmd_status & 1) != 0) { return; } if (ff9Battle.btl_scene.Info.Runaway == 0) { UIManager.Battle.SetBattleFollowMessage((Int32)BattleMesages.CannotEscape); } else { const Int32 fleeScriptId = 0056; if (calc_check && UIManager.Battle.FF9BMenu_IsEnableAtb()) { SBattleCalculator.CalcMain(null, null, null, fleeScriptId); } } }
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); } }
public static void CheckAutoItemAbility(BattleTarget defender, BattleCommand command) { const Byte potion1Id = 236; const Byte potion2Id = 237; const Byte potionScriptId = 069; if (!defender.HasSupportAbility(SupportAbility2.AutoPotion)) { return; } if (defender.IsUnderStatus(BattleStatus.NoReaction) || command.Id > BattleCommandId.EnemyAtk) { return; } Int32 overhealLimit = Configuration.Battle.AutoPotionOverhealLimit; // Vanila if (overhealLimit < 0) { foreach (Byte potionId in new[] { potion1Id, potion2Id }) { if (ff9item.FF9Item_GetCount(potionId) != 0) { UIManager.Battle.ItemRequest(potionId); btl_cmd.SetCounter(defender.Data, BattleCommandId.AutoPotion, potionId, defender.Id); break; } } } // Better auto-potions else { Byte betterPotionId = 0; foreach (Byte potionId in new[] { potion1Id, potion2Id }) { if (ff9item.FF9Item_GetCount(potionId) < 1) { continue; } CMD_DATA testCommand = new CMD_DATA { cmd_no = BattleCommandId.AutoPotion, sub_no = potionId, aa = FF9StateSystem.Battle.FF9Battle.aa_data[0], tar_id = defender.Id, info = new CMD_DATA.SELECT_INFO() }; BattleCalculator v = new BattleCalculator(defender.Data, defender.Data, new BattleCommand(testCommand)); BattleScriptFactory factory = SBattleCalculator.FindScriptFactory(potionScriptId); if (factory != null) { IBattleScript script = factory(v); script.Perform(); } Int16 heal = v.Target.HpDamage; Int32 harm = v.Target.MaximumHp - v.Target.CurrentHp; if (heal - harm > heal * overhealLimit / 100) { break; } betterPotionId = potionId; } if (betterPotionId != 0) { UIManager.Battle.ItemRequest(betterPotionId); btl_cmd.SetCounter(defender.Data, BattleCommandId.AutoPotion, betterPotionId, defender.Id); } } }