/// TEMPORARILY USED FOR EVERYTHING NOT COVERED BY AN EXISTING METHOD
        public static float CalculateModifiedDamage(PokemonData.Type attackerType1, PokemonData.Type attackerType2,
                                                    PokemonData.Type attackerType3, int attackerPosition, int targetPosition, int[][] pokemonStatsMod,
                                                    int[] reflectTurns, int[] lightScreenTurns, MoveData move, float baseDamage, bool applyCritical)
        {
            float modifiedDamage = baseDamage;

            //apply STAB
            if (attackerType1 == move.getType() ||
                attackerType2 == move.getType() ||
                attackerType3 == move.getType())
            {
                modifiedDamage *= 1.5f;
            }

            //apply Offence/Defence boosts
            if (move.getCategory() == MoveData.Category.PHYSICAL)
            {
                modifiedDamage *= CalculateStatModifier(pokemonStatsMod[0][attackerPosition]);
                if (!applyCritical)
                {
                    //exclude defensive buffs in a critical hit
                    modifiedDamage /= CalculateStatModifier(pokemonStatsMod[1][targetPosition]);
                }
            }
            else if (move.getCategory() == MoveData.Category.SPECIAL)
            {
                modifiedDamage *= CalculateStatModifier(pokemonStatsMod[2][attackerPosition]);
                if (!applyCritical)
                {
                    //exclude defensive buffs in a critical hit
                    modifiedDamage /= CalculateStatModifier(pokemonStatsMod[3][targetPosition]);
                }
            }
            //not yet implemented
            //apply held item
            //apply ability
            //apply field advantages
            //reflect/lightScreen
            if (!applyCritical)
            {
                if (move.getCategory() == MoveData.Category.PHYSICAL)
                {
                    if (reflectTurns[Mathf.FloorToInt((float)targetPosition / 3f)] > 0)
                    {
                        modifiedDamage *= 0.5f;
                    }
                }
                else if (move.getCategory() == MoveData.Category.SPECIAL)
                {
                    if (lightScreenTurns[Mathf.FloorToInt((float)targetPosition / 3f)] > 0)
                    {
                        modifiedDamage *= 0.5f;
                    }
                }
            }

            //apply multi-target debuff

            return(Mathf.Floor(modifiedDamage));
        }
예제 #2
0
 public MoveData(eMoves.Move internalName, PokemonData.Type type, Category category, int power, float accuracy, int PP, Target target,
                 int priority, bool contact, bool protectable, bool magicCoatable, bool snatchable,
                 Effect[] moveEffects, float[] moveParameters,
                 Contest contest, int appeal, int jamming /*, string description, string fieldEffect*/)
 {
     //this.name = name;
     this.type           = type;
     this.category       = category;
     this.power          = power;
     this.accuracy       = accuracy;
     this.PP             = PP;
     this.target         = target;
     this.priority       = priority;
     this.contact        = contact;
     this.protectable    = protectable;
     this.magicCoatable  = magicCoatable;
     this.snatchable     = snatchable;
     this.moveEffects    = moveEffects;
     this.moveParameters = moveParameters;
     this.contest        = contest;
     this.appeal         = appeal;
     this.jamming        = jamming;
     //this.description = description;
     //this.fieldEffect = fieldEffect;
 }
예제 #3
0
    public MoveData(string name, PokemonData.Type type, Category category, int power, float accuracy,
                    int PP, Contest contest, int appeal, int jamming, string description, string fieldEffect)
    {
        this.name        = name;
        this.type        = type;
        this.category    = category;
        this.power       = power;
        this.accuracy    = accuracy;
        this.PP          = PP;
        this.contest     = contest;
        this.appeal      = appeal;
        this.jamming     = jamming;
        this.fieldEffect = fieldEffect;
        this.description = description;


        //debug filler data
        this.moveEffects    = new Effect[0];
        this.moveParameters = new float[0];
        this.target         = Target.ADJACENT;
        if (category == Category.PHYSICAL)
        {
            this.contact = true;
        }
        else
        {
            this.contact = false;
        }
        this.protectable = true;
        if (category == Category.STATUS)
        {
            this.magicCoatable = true;
        }
        else
        {
            this.magicCoatable = false;
        }
    }
        /// returns the modifier of a type vs. type. returns as 0f-2f
        public static float GetSuperEffectiveModifier(PokemonData.Type attackingType, PokemonData.Type targetType)
        {
            switch (attackingType)
            {
            case PokemonData.Type.BUG:
                switch (targetType)
                {
                case PokemonData.Type.DARK:
                case PokemonData.Type.GRASS:
                case PokemonData.Type.PSYCHIC:
                    return(2f);

                case PokemonData.Type.FAIRY:
                case PokemonData.Type.FIGHTING:
                case PokemonData.Type.FIRE:
                case PokemonData.Type.FLYING:
                case PokemonData.Type.GHOST:
                case PokemonData.Type.POISON:
                case PokemonData.Type.STEEL:
                    return(0.5f);
                }
                break;

            case PokemonData.Type.DARK:
                switch (targetType)
                {
                case PokemonData.Type.GHOST:
                case PokemonData.Type.PSYCHIC:
                    return(2f);

                case PokemonData.Type.DARK:
                case PokemonData.Type.FAIRY:
                case PokemonData.Type.FIGHTING:
                    return(0.5f);
                }
                break;

            case PokemonData.Type.DRAGON:
                switch (targetType)
                {
                case PokemonData.Type.DRAGON:
                    return(2f);

                case PokemonData.Type.STEEL:
                    return(0.5f);

                case PokemonData.Type.FAIRY:
                    return(0f);
                }
                break;

            case PokemonData.Type.ELECTRIC:
                switch (targetType)
                {
                case PokemonData.Type.FLYING:
                case PokemonData.Type.WATER:
                    return(2f);

                case PokemonData.Type.DRAGON:
                case PokemonData.Type.ELECTRIC:
                case PokemonData.Type.GRASS:
                    return(0.5f);

                case PokemonData.Type.GROUND:
                    return(0f);
                }
                break;

            case PokemonData.Type.FAIRY:
                switch (targetType)
                {
                case PokemonData.Type.DARK:
                case PokemonData.Type.DRAGON:
                case PokemonData.Type.FIGHTING:
                    return(2f);

                case PokemonData.Type.FIRE:
                case PokemonData.Type.POISON:
                case PokemonData.Type.STEEL:
                    return(0.5f);
                }
                break;

            case PokemonData.Type.FIGHTING:
                switch (targetType)
                {
                case PokemonData.Type.DARK:
                case PokemonData.Type.ICE:
                case PokemonData.Type.NORMAL:
                case PokemonData.Type.ROCK:
                case PokemonData.Type.STEEL:
                    return(2f);

                case PokemonData.Type.BUG:
                case PokemonData.Type.FAIRY:
                case PokemonData.Type.FLYING:
                case PokemonData.Type.POISON:
                case PokemonData.Type.PSYCHIC:
                    return(0.5f);

                case PokemonData.Type.GHOST:
                    return(0f);
                }

                break;

            case PokemonData.Type.FIRE:
                switch (targetType)
                {
                case PokemonData.Type.BUG:
                case PokemonData.Type.GRASS:
                case PokemonData.Type.ICE:
                case PokemonData.Type.STEEL:
                    return(2f);

                case PokemonData.Type.DRAGON:
                case PokemonData.Type.FIRE:
                case PokemonData.Type.ROCK:
                case PokemonData.Type.WATER:
                    return(0.5f);
                }
                break;

            case PokemonData.Type.FLYING:
                switch (targetType)
                {
                case PokemonData.Type.BUG:
                case PokemonData.Type.FIGHTING:
                case PokemonData.Type.GRASS:
                    return(2f);

                case PokemonData.Type.ELECTRIC:
                case PokemonData.Type.ROCK:
                case PokemonData.Type.STEEL:
                    return(0.5f);
                }
                break;

            case PokemonData.Type.GHOST:
                switch (targetType)
                {
                case PokemonData.Type.GHOST:
                case PokemonData.Type.PSYCHIC:
                    return(2f);

                case PokemonData.Type.DARK:
                    return(0.5f);

                case PokemonData.Type.NORMAL:
                    return(0f);
                }
                break;

            case PokemonData.Type.GRASS:
                switch (targetType)
                {
                case PokemonData.Type.GROUND:
                case PokemonData.Type.ROCK:
                case PokemonData.Type.WATER:
                    return(2f);

                case PokemonData.Type.BUG:
                case PokemonData.Type.DRAGON:
                case PokemonData.Type.FIRE:
                case PokemonData.Type.FLYING:
                case PokemonData.Type.GRASS:
                case PokemonData.Type.POISON:
                case PokemonData.Type.STEEL:
                    return(0.5f);
                }
                break;

            case PokemonData.Type.GROUND:
                switch (targetType)
                {
                case PokemonData.Type.ELECTRIC:
                case PokemonData.Type.FIRE:
                case PokemonData.Type.POISON:
                case PokemonData.Type.ROCK:
                case PokemonData.Type.STEEL:
                    return(2f);

                case PokemonData.Type.BUG:
                case PokemonData.Type.GRASS:
                    return(0.5f);

                case PokemonData.Type.FLYING:
                    return(0f);
                }
                break;

            case PokemonData.Type.ICE:
                switch (targetType)
                {
                case PokemonData.Type.DRAGON:
                case PokemonData.Type.FLYING:
                case PokemonData.Type.GRASS:
                case PokemonData.Type.GROUND:
                    return(2f);

                case PokemonData.Type.FIRE:
                case PokemonData.Type.ICE:
                case PokemonData.Type.STEEL:
                case PokemonData.Type.WATER:
                    return(0.5f);
                }
                break;

            case PokemonData.Type.NORMAL:
                switch (targetType)
                {
                case PokemonData.Type.ROCK:
                case PokemonData.Type.STEEL:
                    return(0.5f);

                case PokemonData.Type.GHOST:
                    return(0f);
                }
                break;

            case PokemonData.Type.POISON:
                switch (targetType)
                {
                case PokemonData.Type.FAIRY:
                case PokemonData.Type.GRASS:
                    return(2f);

                case PokemonData.Type.POISON:
                case PokemonData.Type.GROUND:
                case PokemonData.Type.ROCK:
                case PokemonData.Type.GHOST:
                    return(0.5f);

                case PokemonData.Type.STEEL:
                    return(0f);
                }
                break;

            case PokemonData.Type.PSYCHIC:
                switch (targetType)
                {
                case PokemonData.Type.FIGHTING:
                case PokemonData.Type.POISON:
                    return(2f);

                case PokemonData.Type.PSYCHIC:
                case PokemonData.Type.STEEL:
                    return(0.5f);

                case PokemonData.Type.DARK:
                    return(0f);
                }
                break;

            case PokemonData.Type.ROCK:
                switch (targetType)
                {
                case PokemonData.Type.BUG:
                case PokemonData.Type.FIRE:
                case PokemonData.Type.FLYING:
                case PokemonData.Type.ICE:
                    return(2f);

                case PokemonData.Type.FIGHTING:
                case PokemonData.Type.GROUND:
                case PokemonData.Type.STEEL:
                    return(0.5f);
                }
                break;

            case PokemonData.Type.STEEL:
                switch (targetType)
                {
                case PokemonData.Type.FAIRY:
                case PokemonData.Type.ICE:
                case PokemonData.Type.ROCK:
                    return(2f);

                case PokemonData.Type.ELECTRIC:
                case PokemonData.Type.FIRE:
                case PokemonData.Type.STEEL:
                case PokemonData.Type.WATER:
                    return(0.5f);
                }
                break;

            case PokemonData.Type.WATER:
                switch (targetType)
                {
                case PokemonData.Type.FIRE:
                case PokemonData.Type.GROUND:
                case PokemonData.Type.ROCK:
                    return(2f);

                case PokemonData.Type.DRAGON:
                case PokemonData.Type.GRASS:
                case PokemonData.Type.WATER:
                    return(0.5f);
                }
                break;
            }
            return(1f);
        }
예제 #5
0
 /// <summary>
 /// Converts the Pokemon Type to a Color in Unity.
 /// </summary>
 /// <param name="PokemonType">pokemon type</param>
 /// <returns>return a Unity.Color</returns>
 /// <example>StringToColor(Electric)</example>
 public Color StringToColor(PokemonData.Type PokemonType)
 {
     return(StringToColor(PokemonType.ToString()));        //Will fix later
 }
예제 #6
0
    private Sprite typeToImage(PokemonData.Type type)
    {
        string path = AssetDatabase.GetAssetPath(typesheet);

        Sprite[] types = AssetDatabase.LoadAllAssetsAtPath(path).OfType <Sprite>().ToArray();

        if (type == PokemonData.Type.NORMAL)
        {
            return(types [0]);
        }
        else if (type == PokemonData.Type.FIGHTING)
        {
            return(types [1]);
        }
        else if (type == PokemonData.Type.FLYING)
        {
            return(types [2]);
        }
        else if (type == PokemonData.Type.POISON)
        {
            return(types [3]);
        }
        else if (type == PokemonData.Type.GROUND)
        {
            return(types [4]);
        }
        else if (type == PokemonData.Type.ROCK)
        {
            return(types [5]);
        }
        else if (type == PokemonData.Type.BUG)
        {
            return(types [6]);
        }
        else if (type == PokemonData.Type.GHOST)
        {
            return(types [7]);
        }
        else if (type == PokemonData.Type.STEEL)
        {
            return(types [8]);
        }
        else if (type == PokemonData.Type.NONE)
        {
            return(types [9]);
        }
        else if (type == PokemonData.Type.FIRE)
        {
            return(types [10]);
        }
        else if (type == PokemonData.Type.WATER)
        {
            return(types [11]);
        }
        else if (type == PokemonData.Type.GRASS)
        {
            return(types [12]);
        }
        else if (type == PokemonData.Type.ELECTRIC)
        {
            return(types [13]);
        }
        else if (type == PokemonData.Type.PSYCHIC)
        {
            return(types [14]);
        }
        else if (type == PokemonData.Type.ICE)
        {
            return(types [15]);
        }
        else if (type == PokemonData.Type.DRAGON)
        {
            return(types [15]);
        }
        else if (type == PokemonData.Type.DARK)
        {
            return(types [16]);
        }
        else if (type == PokemonData.Type.FAIRY)
        {
            return(types [17]);
        }
        else
        {
            return(types [9]);
        }
    }
예제 #7
0
 private Texture typeToImage(PokemonData.Type type)
 {
     if (type == PokemonData.Type.NORMAL)
     {
         return(types [0]);
     }
     else if (type == PokemonData.Type.FIGHTING)
     {
         return(types [1]);
     }
     else if (type == PokemonData.Type.FLYING)
     {
         return(types [2]);
     }
     else if (type == PokemonData.Type.POISON)
     {
         return(types [3]);
     }
     else if (type == PokemonData.Type.GROUND)
     {
         return(types [4]);
     }
     else if (type == PokemonData.Type.ROCK)
     {
         return(types [5]);
     }
     else if (type == PokemonData.Type.BUG)
     {
         return(types [6]);
     }
     else if (type == PokemonData.Type.GHOST)
     {
         return(types [7]);
     }
     else if (type == PokemonData.Type.STEEL)
     {
         return(types [8]);
     }
     else if (type == PokemonData.Type.NONE)
     {
         return(types [9]);
     }
     else if (type == PokemonData.Type.FIRE)
     {
         return(types [10]);
     }
     else if (type == PokemonData.Type.WATER)
     {
         return(types [11]);
     }
     else if (type == PokemonData.Type.GRASS)
     {
         return(types [12]);
     }
     else if (type == PokemonData.Type.ELECTRIC)
     {
         return(types [13]);
     }
     else if (type == PokemonData.Type.PSYCHIC)
     {
         return(types [14]);
     }
     else if (type == PokemonData.Type.ICE)
     {
         return(types [15]);
     }
     else if (type == PokemonData.Type.DRAGON)
     {
         return(types [16]);
     }
     else if (type == PokemonData.Type.DARK)
     {
         return(types [17]);
     }
     else if (type == PokemonData.Type.FAIRY)
     {
         return(types [18]);
     }
     else
     {
         return(types [9]);
     }
 }