示例#1
0
        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);
        }
示例#2
0
 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);
 }