Esempio n. 1
0
 public PokemonArchetype(string name, int pokemonNumber, ElementType primaryType, ElementType secondaryType, string pokedexText, bool evolves, 
     int nextEvolutionPokemonNumber, int baseHealth, int baseAttack, int baseDefense,
     int baseSpecialAttack, int baseSpecialDefense, int baseSpeed, int maxHealth, int maxAttack, int maxDefense,
     int maxSpecialAttack, int maxSpecialDefense, int maxSpeed, Texture2D texture, Rectangle sourceRectangleBack,
     Rectangle sourceRectangleFront, Rectangle sourceRectangleInventory1, Rectangle sourceRectangleInventory2,
     ExperienceGroup experienceGroup, Dictionary<int, MoveArchetype> levelledMoves, Gender restrictedGender)
 {
     Name = name;
     PokemonNumber = pokemonNumber;
     PrimaryType = primaryType;
     SecondaryType = secondaryType;
     PokedexText = pokedexText;
     Evolves = evolves;
     NextEvolutionPokemonNumber = nextEvolutionPokemonNumber;
     BaseStats.Add(Stats.Health, baseHealth);
     BaseStats.Add(Stats.Defense, baseDefense);
     BaseStats.Add(Stats.Attack, baseAttack);
     BaseStats.Add(Stats.SpecialAttack, baseSpecialAttack);
     BaseStats.Add(Stats.SpecialDefense, baseSpecialDefense);
     BaseStats.Add(Stats.Speed, baseSpeed);
     MaxStats.Add(Stats.Health, maxHealth);
     MaxStats.Add(Stats.Defense, maxDefense);
     MaxStats.Add(Stats.Attack, maxAttack);
     MaxStats.Add(Stats.SpecialAttack, maxSpecialAttack);
     MaxStats.Add(Stats.SpecialDefense, maxSpecialDefense);
     MaxStats.Add(Stats.Speed, maxSpeed);
     Texture = texture;
     SourceRectangleBack = sourceRectangleBack;
     SourceRectangleFront = sourceRectangleFront;
     SourceRectangleInventory1 = sourceRectangleInventory1;
     SourceRectangleInventory2 = sourceRectangleInventory2;
     ExperienceGroup = experienceGroup;
     LevelledMoves = levelledMoves;
     RestrictedGender = restrictedGender;
 }
        public static int ExperienceToLevel(ExperienceGroup experienceGroup, int toLevel)
        {
            double exp_required = 0.0;

            // #todo Implement other experience groups

            switch (experienceGroup)
            {
            case ExperienceGroup.Erratic:

                if (toLevel <= 50)
                {
                    exp_required = Math.Pow(toLevel, 3) * (100 - toLevel) / 50;
                }
                else if (toLevel <= 50 && toLevel <= 68)
                {
                    exp_required = Math.Pow(toLevel, 3) * (150 - toLevel) / 100;
                }
                else if (toLevel <= 68 && toLevel <= 98)
                {
                    exp_required = Math.Pow(toLevel, 3) * Math.Floor((1911 - (10 * toLevel)) / 3.0);
                }
                else
                {
                    exp_required = Math.Pow(toLevel, 3) * (160 - toLevel) / 100;
                }

                break;

            case ExperienceGroup.Fast:

                exp_required = 4 * Math.Pow(toLevel, 3) / 5;

                break;

            case ExperienceGroup.MediumFast:

                exp_required = Math.Pow(toLevel, 3);

                break;

            case ExperienceGroup.MediumSlow:

                exp_required = (6.0 / 5.0 * Math.Pow(toLevel, 3)) - (15 * Math.Pow(toLevel, 2)) + (100 * toLevel) - 140;

                break;

            case ExperienceGroup.Slow:

                exp_required = 5 * Math.Pow(toLevel, 3) / 4;

                break;

            default:
                goto case ExperienceGroup.MediumFast;
            }

            return((int)exp_required);
        }
Esempio n. 3
0
 public Pokemon(string species, IList <PokemonType> types, IStatistics stats, ExperienceGroup expGroup, MovePool movePool, IList <Ability> abilityPool, int friendship)
 {
     Species     = species;
     Types       = new List <PokemonType>(types).AsReadOnly();
     Stats       = stats;
     ExpGroup    = expGroup;
     MovePool    = movePool;
     AbilityPool = new List <Ability>(abilityPool).AsReadOnly();
     Friendship  = friendship;
 }
Esempio n. 4
0
 //function called during initial set up of monster in data base
 public void SetUpInitialValues(int id, string name, double[] baseStats, MonsterType type1, MonsterType type2, ExperienceGroup eGroup)
 {
     m_SpeciesNumber                    = id;
     m_SpeciesName                      = name;
     m_BaseStats[MonsterStat.HP]        = baseStats[0];
     m_BaseStats[MonsterStat.ATTACK]    = baseStats[1];
     m_BaseStats[MonsterStat.DEFENCE]   = baseStats[2];
     m_BaseStats[MonsterStat.SPATTACK]  = baseStats[3];
     m_BaseStats[MonsterStat.SPDEFENCE] = baseStats[4];
     m_BaseStats[MonsterStat.SPEED]     = baseStats[5];
     m_Type1           = type1;
     m_Type2           = type2;
     m_ExperienceGroup = eGroup;
 }
        public static int GetLevel(ExperienceGroup experienceGroup, int experience)
        {
            int level = 1;

            for (int i = 2; i < int.MaxValue; ++i)
            {
                if (experience >= ExperienceToLevel(experienceGroup, i))
                {
                    ++level;
                }
                else
                {
                    break;
                }
            }

            return(level);
        }
Esempio n. 6
0
        public static int ExperienceNeededForLevel(this ExperienceGroup expGroup, int level)
        {
            switch (expGroup)
            {
            case ExperienceGroup.Erratic:
                return(ExpErratic(level));

            case ExperienceGroup.Fast:
                return(ExpFast(level));

            case ExperienceGroup.MediumFast:
                return(ExpMediumFast(level));

            case ExperienceGroup.MediumSlow:
                return(ExpMediumSlow(level));

            case ExperienceGroup.Slow:
                return(ExpSlow(level));

            case ExperienceGroup.Fluctuating:
                return(ExpFluctuating(level));
            }
            throw new Exception($"Unrecognized ExperienceGroup type {expGroup.ToString()}");
        }
Esempio n. 7
0
    //Load all unique base monster data from file into memory
    public static Dictionary <int, Monster> LoadMonsterData()
    {
        //encrypt original file and then load the encrypted file
        EncryptXMLFile("Assets/Resources/XMLs/Monsters_Original.xml", "Assets/Resources/XMLs/Monsters_Safe.xml");
        string monsterFile = LoadEncryptedXMLFile("Assets/Resources/XMLs/Monsters_Safe.xml");

        //create temporary dictionary to store and return data
        Dictionary <int, Monster> monsterData = new Dictionary <int, Monster>();

        //loop through file and fill collection accordingly
        using (XmlReader reader = XmlReader.Create(new StringReader(monsterFile)))
        {
            //get amount of monsters to add to collection
            reader.ReadToFollowing("Amount");
            int amount = reader.ReadElementContentAsInt();

            //loop through each monster and extract base values
            //create unique base monster for each input and add to collection
            for (int i = 0; i < amount; ++i)
            {
                //get species number used for dictionary key
                reader.ReadToFollowing("ID");
                int key = reader.ReadElementContentAsInt();

                //get species name
                reader.ReadToFollowing("Name");
                string name = reader.ReadElementContentAsString();

                //get 6 base stats and store in array
                reader.ReadToFollowing("Base");
                string[] baseStats  = reader.ReadElementContentAsString().Split(',');
                double[] statsArray = new double[6];

                for (int j = 0; j < baseStats.Length; ++j)
                {
                    statsArray[j] = double.Parse(baseStats[j]);
                }

                //get type(s)
                reader.ReadToFollowing("Type");
                string[]    types = reader.ReadElementContentAsString().Split(',');
                MonsterType type1 = (MonsterType)Enum.Parse(typeof(MonsterType), types[0]);
                MonsterType type2 = MonsterType.NONE;

                if (types.Length > 1)
                {
                    type2 = (MonsterType)Enum.Parse(typeof(MonsterType), types[1]);
                }

                //get experience group
                reader.ReadToFollowing("EGroup");
                ExperienceGroup eGroup = (ExperienceGroup)reader.ReadElementContentAsInt();

                //create new monster with data and add to collection
                Monster monster = new Monster();
                monster.SetUpInitialValues(key, name, statsArray, type1, type2, eGroup);

                monsterData.Add(key, monster);
            }
        }

        return(monsterData);
    }
Esempio n. 8
0
    private static void InitializeResources(ExperienceType experienceType, ResourceType resourceType, string category)
    {
        m_resources = null;
        switch (experienceType)
        {
        case ExperienceType.NATURE:
            if (resourceType == ResourceType.LOCATION)
            {
                ExperienceGroup group = Array.Find(m_assetDb.NatureLocationsGroups, item => item.Name == category);
                if (group != null)
                {
                    m_resources = group.Resources;
                }
            }

            if (resourceType == ResourceType.MUSIC)
            {
                AudioGroup group = Array.Find(m_assetDb.NatureMusic, item => item.Name == category);
                if (group != null)
                {
                    m_resources = group.Resources;
                }
            }
            break;

        case ExperienceType.MANDALA:
            if (resourceType == ResourceType.COLOR)
            {
                ColorGroup group = Array.Find(m_assetDb.ColorGroups, item => item.Name == category);
                if (group != null)
                {
                    m_resources = group.Resources;
                }
            }

            if (resourceType == ResourceType.MUSIC)
            {
                AudioGroup group = Array.Find(m_assetDb.MandalaMusic, item => item.Name == category);
                if (group != null)
                {
                    m_resources = group.Resources;
                }
            }
            break;

        case ExperienceType.ABSTRACT:
            if (resourceType == ResourceType.LOCATION)
            {
                ExperienceGroup group = Array.Find(m_assetDb.AbstractLocationsGroups, item => item.Name == category);
                if (group != null)
                {
                    m_resources = group.Resources;
                }
            }

            if (resourceType == ResourceType.MUSIC)
            {
                AudioGroup group = Array.Find(m_assetDb.AbstractMusic, item => item.Name == category);
                if (group != null)
                {
                    m_resources = group.Resources;
                }
            }
            break;

        case ExperienceType.GLOBAL:
            if (resourceType == ResourceType.GUIDE_AUDIO)
            {
                GuideAudioGroup group = Array.Find(m_assetDb.GuideAudioGroups, item => item.Name == category);
                if (group != null)
                {
                    m_resources = group.Resources;
                }
            }

            if (resourceType == ResourceType.AUDIO)
            {
                AudioGroup group = Array.Find(m_assetDb.AudioGroups, item => item.Name == category);
                if (group != null)
                {
                    m_resources = group.Resources;
                }
            }

            if (resourceType == ResourceType.OBJECT)
            {
                ObjectGroup group = Array.Find(m_assetDb.ObjectGroups, item => item.Name == category);
                if (group != null)
                {
                    m_resources = group.Resources;
                }
            }
            break;

        default:
            break;
        }

        if (m_resources == null)
        {
            return;
        }

        m_name        = new string[m_resources.Length];
        m_color       = new Color[m_resources.Length];
        m_description = new string[m_resources.Length];
        m_sprite      = new Sprite[m_resources.Length];
        m_clip        = new AudioClip[m_resources.Length];
    }
 public static int GetLevel(ExperienceGroup experienceGroup, Gotchi gotchi)
 {
     return(GetLevel(experienceGroup, gotchi.Experience));
 }
        public static int ExperienceToLevel(ExperienceGroup experienceGroup, int currentExperience, int targetLevel)
        {
            int experienceToTargetLevel = ExperienceToLevel(experienceGroup, targetLevel);

            return(Math.Max(0, experienceToTargetLevel - currentExperience));
        }