Exemplo n.º 1
0
    void UpdateHeroStats(GameObject hero)
    {
        ElementalStats heroStats  = hero.GetComponent <ElementalStats>();
        PV             heroPV     = hero.GetComponent <PV>();
        Weapons        heroWeapon = hero.GetComponent <Weapons>();

        float lifePower = heroPV.initialHP * (1f + (nbHealthUpgrades / 10f));


        float standardPower = heroStats.initialPower * (1f + (nbStandardUpgrades / 10f));
        int   firePower     = 1 + nbElementalUpgrades[ElementalStats.Element.Fire];
        int   groundPower   = 1 + nbElementalUpgrades[ElementalStats.Element.Ground];
        int   icePower      = 1 + nbElementalUpgrades[ElementalStats.Element.Ice];
        int   windPower     = 1 + nbElementalUpgrades[ElementalStats.Element.Wind];

        int standardAttack = Mathf.CeilToInt(standardPower);

        // Set life
        heroPV.SetPV(lifePower);

        // Set stats
        heroStats.standardPower = Mathf.CeilToInt(standardPower);
        heroStats.stats[ElementalStats.Element.Fire]   = firePower;
        heroStats.stats[ElementalStats.Element.Ground] = groundPower;
        heroStats.stats[ElementalStats.Element.Ice]    = icePower;
        heroStats.stats[ElementalStats.Element.Wind]   = windPower;

        // Set damages
        heroWeapon.damage          = Mathf.CeilToInt(standardPower * 2f);
        heroWeapon.elementalDamage = Mathf.CeilToInt(heroStats.stats[heroStats.selectedElement] * 2f);
    }
Exemplo n.º 2
0
 public EntityStats(float speed, float maxHp, ElementalStats spellElementalMod, ElementalStats rechargeRate, ElementalStats elementalResistance, ElementalStats maxElementalCharge)
 {
     this._speed = speed;
     this._maxHp = maxHp;
     this._spellElementalModifier = spellElementalMod;
     this._rechargeRate = rechargeRate;
     this._elementalResistance = elementalResistance;
     this._maxElementalCharge = maxElementalCharge;
 }
Exemplo n.º 3
0
 internal ColossoFighter(string name, string imgUrl, Stats stats, ElementalStats elstats, Move[] moves)
 {
     this.name     = name;
     this.imgUrl   = imgUrl;
     this.stats    = stats;
     this.stats.HP = stats.MaxHP;
     this.stats.PP = stats.MaxPP;
     this.elstats  = elstats;
     this.moves    = moves;
 }
Exemplo n.º 4
0
        public NPCEnemy(string name, string imgUrl, Stats stats, ElementalStats elstats, string[] movepool, bool hasAttack, bool hasDefend) : base()
        {
            this.Name    = name;
            this.ImgUrl  = imgUrl;
            this.Stats   = stats;
            this.ElStats = elstats;
            this.Moves   = PsynergyDatabase.GetMovepool(movepool, hasAttack, hasDefend);

            this.Movepool  = movepool;
            this.HasAttack = hasAttack;
            this.HasDefend = hasDefend;
        }
Exemplo n.º 5
0
        public NpcEnemy(string name, string imgUrl, Stats stats, ElementalStats elstats, string[] movepool,
                        bool hasAttack, bool hasDefend)
        {
            Name    = name;
            ImgUrl  = imgUrl;
            Stats   = stats;
            ElStats = elstats;

            Moves = PsynergyDatabase.GetMovepool(movepool, hasAttack, hasDefend);

            Movepool  = movepool;
            HasAttack = hasAttack;
            HasDefend = hasDefend;
        }
Exemplo n.º 6
0
    public void GenerateEnemy()
    {
        nbTotalEnemies++;
        float currentTime = Time.time - initialTime;

        int lifeRatio         = Random.Range(50, 100);
        int damageRatio       = 100 - lifeRatio;
        int elementalSubRatio = Random.Range(1, 30);

        float lifePower = initialLife + (initialLife * lifeRatio / 100f)         // Random Modifier
                          * (currentTime / timeStepDuration) * lifeEvolutionRate // Time Modifier
                          * lifeUpdate;                                          // Magic Modifier


        float statsPower = initialPower + (initialPower * damageRatio / 100f)
                           * (currentTime / timeStepDuration) * powerEvolutionRate // Time Modifier
                           * powerUpdate;                                          // Magic Modifier

        float subElementalPower = statsPower * elementalSubRatio / 100f;
        float subStandardPower  = statsPower - subElementalPower;

        // Set life
        enemySlot.GetComponent <PV>().SetPV(lifePower);

        // Set stats
        ElementalStats ennemyElementalStats = enemySlot.GetComponent <ElementalStats>();

        ElementalStats.Element elementType = (ElementalStats.Element)Random.Range(1, 5);
        ennemyElementalStats.ResetStats();
        ennemyElementalStats.standardPower      = Mathf.CeilToInt(subStandardPower);
        ennemyElementalStats.stats[elementType] = Mathf.CeilToInt(subElementalPower);

        // Set damages
        enemySlot.GetComponent <Weapons>().damage          = Mathf.CeilToInt(subStandardPower * damageUpdate);
        enemySlot.GetComponent <Weapons>().elementalDamage = Mathf.CeilToInt(subElementalPower * damageUpdate);
    }
Exemplo n.º 7
0
 private ElementalStats GetElementalStatsRatioValue(ElementalStats min, ElementalStats max, float ratio)
 {
     ElementalStats es = ElementalStats.Zero;
     foreach (Element e in Enum.GetValues(typeof(Element)))
     {
         es[e] = GetRatioValue(min[e], max[e], ratio);
     }
     return es;
 }
Exemplo n.º 8
0
 public NPCEnemy(string name, string imgUrl, Stats stats, ElementalStats elstats, string[] movepool, bool hasAttack, bool hasDefend) : base(name, imgUrl, stats, elstats, PsynergyDatabase.GetMovepool(movepool, hasAttack, hasDefend))
 {
     this.Movepool  = movepool;
     this.HasAttack = hasAttack;
     this.HasDefend = hasDefend;
 }
 void ElementalSubtract(ElementalStats obj)
 {
     if (obj.fire > 0)
         _fireParticles.Emit(transform.position);
 }
Exemplo n.º 10
0
 public ElementalStats Difference(ElementalStats other)
 {
     ElementalStats stats = ElementalStats.Zero;
     foreach (Element e in Enum.GetValues(typeof(Element)))
     {
         stats[e] = this[e] + (other[e] * -1);
     }
     return stats;
 }
Exemplo n.º 11
0
 /// <summary>
 /// Set the recharge lock to lock a spellID if a passed in stat is greater than 0
 /// </summary>
 /// <param name="stats"></param>
 public void SetRechargeLock(ElementalStats stats)
 {
     foreach (Element e in Enum.GetValues(typeof(Element)))
     {
         // Setting recharge lock to 0 will cause the element of that type not to be updated
         _rechargeLock[e] = stats[e] > 0 ? 0 : _rechargeLock[e];
     }
 }
Exemplo n.º 12
0
    public void SubtractElementCost(ElementalStats element)
    {
        if (SpellsIgnoreElementalCost)
            return;

        CurrentElementalCharge -= element;
        SetRechargeLock(element);
        if (OnElementalSubtract != null)
        {
            OnElementalSubtract(element);
        }
    }