コード例 #1
0
 public static float GetEffectiveness(PokemonUnity.Types atk, PokemonUnity.Types target)
 {
     if (target == Types.NONE)
     {
         return(2);               //return 1?
     }
     return(Game.TypeData[atk][target]);
 }
コード例 #2
0
        public static float GetCombinedEffectivenessModifier(PokemonUnity.Types atk, PokemonUnity.Types target1, PokemonUnity.Types target2 = Types.NONE, PokemonUnity.Types target3 = Types.NONE)
        {
            float mod1 = GetEffectiveness(atk, target1);
            float mod2 = 1;

            if (target2 >= 0 && target1 != target2)
            {
                mod2 = GetEffectiveness(atk, target2);
            }
            float mod3 = 1;

            if (target3 >= 0 && target1 != target3 && target2 != target3)
            {
                mod3 = GetEffectiveness(atk, target2);
            }
            return(mod1 * mod2 * mod3);
        }
コード例 #3
0
        public static Combat.TypeEffective GetCombinedEffectiveness(PokemonUnity.Types atk, PokemonUnity.Types target1, PokemonUnity.Types target2 = Types.NONE, PokemonUnity.Types target3 = Types.NONE)
        {
            float e = GetCombinedEffectivenessModifier(atk, target1, target2, target3);

            if (e == 0)
            {
                return(Combat.TypeEffective.Ineffective);
            }
            else if (e > 0 && e < 8)
            {
                return(Combat.TypeEffective.NotVeryEffective);
            }
            else if (e == 8)
            {
                return(Combat.TypeEffective.NormalEffective);
            }
            else             //if (e > 8)
            {
                return(Combat.TypeEffective.SuperEffective);
            }
            //return TypeEffective.Broken;
        }