public static Boolean CheckCounterAbility(BattleTarget defender, BattleCaster attacker, BattleCommand command) { if (defender.IsUnderStatus(BattleStatus.NoReaction) || command.Id > BattleCommandId.EnemyAtk) { return(false); } if (defender.HasSupportAbility(SupportAbility2.Counter) && (command.Data.aa.Category & 8) != 0) // Physical { Int32 chance = defender.Will; if (defender.HasSupportAbility(SupportAbility2.Eye4Eye)) { chance *= 2; } if (chance > Comn.random16() % 100) { btl_cmd.SetCounter(defender.Data, BattleCommandId.Counter, 176, attacker.Id); return(true); } } if (defender.HasSupportAbility(SupportAbility2.ReturnMagic) && (command.Data.aa.Category & 128) != 0) // Magic { btl_cmd.SetCounter(defender.Data, BattleCommandId.MagicCounter, command.Data.sub_no, attacker.Id); return(true); } return(false); }
public static UInt16 GetRandomBtlID(UInt32 player) { UInt16[] array = new UInt16[4]; UInt16 num = 0; if (player != 0u) { player = 1u; } for (BTL_DATA next = FF9StateSystem.Battle.FF9Battle.btl_list.next; next != null; next = next.next) { if ((UInt32)next.bi.player == player && !Status.checkCurStat(next, 256u) && next.bi.target != 0) { UInt16[] array2 = array; UInt16 num2 = num; num = (UInt16)(num2 + 1); array2[(Int32)num2] = next.btl_id; } } if (num == 0) { return(0); } return(array[Comn.random8() % (Int32)num]); }
public static Boolean CheckCounterAbility(BTL_DATA btl, BTL_DATA target, CMD_DATA cmd) { if (!Status.checkCurStat(btl, 1107300611u) && cmd.cmd_no < 48) { if ((btl.sa[1] & 16u) != 0u && (cmd.aa.Category & 8) != 0) { Int32 num = (Int32)btl.elem.wpr; if ((btl.sa[1] & 128u) != 0u) { num *= 2; } if (num > Comn.random16() % 100) { btl_cmd.SetCounter(btl, 49u, 176, target.btl_id); return(true); } } if ((btl.sa[1] & 4194304u) != 0u && (cmd.aa.Category & 128) != 0) { btl_cmd.SetCounter(btl, 50u, (Int32)cmd.sub_no, target.btl_id); return(true); } } return(false); }
public static void SetBonus(ENEMY_TYPE et) { BONUS btlBonus = battle.btl_bonus; btlBonus.gil += et.bonus.gil; btlBonus.exp += et.bonus.exp; Byte num1 = 0; while (num1 < 16 && btlBonus.item[num1] != Byte.MaxValue) { ++num1; } if (num1 < 16) { if (Comn.random8() < 1 && et.bonus.item[3] != Byte.MaxValue) { btlBonus.item[num1++] = et.bonus.item[3]; et.bonus.item[3] = Byte.MaxValue; } else if (Comn.random8() < 32 && et.bonus.item[2] != Byte.MaxValue) { btlBonus.item[num1++] = et.bonus.item[2]; et.bonus.item[2] = Byte.MaxValue; } else if (Comn.random8() < 96 && et.bonus.item[1] != Byte.MaxValue) { btlBonus.item[num1++] = et.bonus.item[1]; et.bonus.item[1] = Byte.MaxValue; } if (et.bonus.item[0] != Byte.MaxValue) { Byte[] numArray = btlBonus.item; Int32 index = num1; //int num2 = 1; //byte num3 = (byte)(index + num2); Int32 num4 = et.bonus.item[0]; numArray[index] = (Byte)num4; } } if (btlBonus.card != Byte.MaxValue || et.bonus.card >= 100U || Comn.random8() >= 32) { return; } btlBonus.card = (Byte)et.bonus.card; }
public static Byte StartType(BTL_SCENE_INFO info) { Byte num1 = 2; if (info.SpecialStart != 0) { if (info.BackAttack != 0) { num1 = 0; } } else { Byte num2 = 24; if (btl_abil.CheckPartyAbility(1U, 512U)) { num2 = 0; } else if (info.BackAttack != 0) { num2 = Byte.MaxValue; } if (Comn.random8() < num2) { num1 = 0; } else { Byte num3 = 16; if (btl_abil.CheckPartyAbility(1U, 1024U)) { num3 = 85; } if (Comn.random8() < num3) { num1 = 1; } } } if (num1 == 0) { BattleAchievement.UpdateBackAttack(); } return(num1); }
public static void CheckBattlePhase(BTL_DATA btl) { FF9StateBattleSystem ff9Battle = FF9StateSystem.Battle.FF9Battle; Int32 num1 = 6; /*btl.bi.player == 0 ? 6 : 6*/ for (BTL_DATA next = ff9Battle.btl_list.next; next != null; next = next.next) { if (next.bi.player == btl.bi.player && (!Status.checkCurStat(next, BattleStatus.BattleEnd) || Status.checkCurStat(next, BattleStatus.Death) && next.die_seq != num1)) { return; } } if (btl.bi.player == 0) { Int32 num2 = 0; for (BTL_DATA next = ff9Battle.btl_list.next; next != null; next = next.next) { if (next.bi.player != 0 && (!Status.checkCurStat(next, BattleStatus.BattleEnd) || (next.cur.hp == 0 || Status.checkCurStat(next, BattleStatus.Death)) && Status.checkCurStat(next, BattleStatus.AutoLife) || btl_cmd.CheckSpecificCommand(next, BattleCommandId.SysReraise))) { num2 = 1; break; } } if (num2 == 0) { return; } if (ff9Battle.btl_seq != 1) { ff9Battle.btl_seq = 0; } } else { for (BTL_DATA next = ff9Battle.btl_list.next; next != null; next = next.next) { switch (btl_util.getSerialNumber(next)) { case 10: case 11: if (!Status.checkCurStat(next, BattleStatus.Petrify | BattleStatus.Venom | BattleStatus.Zombie | BattleStatus.Stop)) { if (btl_cmd.CheckSpecificCommand(next, BattleCommandId.SysLastPhoenix)) { return; } if (ff9item.FF9Item_GetCount(249) > Comn.random8()) { UIManager.Battle.FF9BMenu_EnableMenu(true); btl_cmd.SetCommand(next.cmd[0], BattleCommandId.SysLastPhoenix, 73U, btl_scrp.GetBattleID(0U), 1U); return; } break; } goto label_24; } } label_24: ff9Battle.btl_seq = 1; UIManager.Battle.SetBattleFollowMessage((Int32)BattleMesages.Annihilated); } UIManager.Battle.FF9BMenu_EnableMenu(false); ff9Battle.btl_phase = 5; btl_cmd.KillAllCommand(ff9Battle); }