public virtual int Decrease_Value(int amount) { int negative_Amount = amount * -1; _value.AddModifier(new StatModifier(negative_Amount, StatModType.Flat, this)); tracker.Decrease(Mathf.Abs(negative_Amount)); return(Get_Value()); }
public void DmgCollision(float damage) { StatModifier collisionDmg = new StatModifier(damage, StatModType.Flat); health.AddModifier(collisionDmg); if (health.Value <= 0) { PlayerSkills ps = (PlayerSkills)player.GetComponent(typeof(PlayerSkills)); ps.GainXP(xp); if (boss != "") { Debug.Log("Pronto passaste, toma lá os ECTs..."); player.GetComponent <PlayerStats>().CompleteUC(boss); GameObject.Find("GameManager").GetComponent <GameManager>().BossResult("Won"); if (boss == "ALGE") { GameObject.Find("door9").GetComponent <AudioSource>().Stop(); } else if (boss == "FPRO") { GameObject.Find("door11").GetComponent <AudioSource>().Stop(); } GameObject.Find("Teleporter").GetComponent <Teleporter>().Leave(); } Destroy(gameObject); } }
public void UpgradeSkill(int type, float value) //type: (0 - fireBallRange) - (11 -poisonTime) same order above { StatModifier modifierPerc = new StatModifier(value, StatModType.PercentMult); StatModifier modifierPercAdd = new StatModifier(value, StatModType.PercentAdd); StatModifier modifierAdd = new StatModifier(value, StatModType.Flat); switch (type) { case 0: fireBallRange.AddModifier(modifierAdd); break; case 1: fireBallCooldown.AddModifier(modifierPerc); break; case 2: fireBallDamage.AddModifier(modifierPercAdd); break; case 3: fireBallProjectilesNumber.AddModifier(modifierAdd); break; case 4: chainRange.AddModifier(modifierAdd); break; case 5: chainCooldown.AddModifier(modifierPerc); break; case 6: chainDamage.AddModifier(modifierPercAdd); break; case 7: chainNumberBounces.AddModifier(modifierAdd); break; case 8: poisonRange.AddModifier(modifierAdd); break; case 9: poisonCooldown.AddModifier(modifierPerc); break; case 10: poisonDamage.AddModifier(modifierPercAdd); break; case 11: poisonTime.AddModifier(modifierPercAdd); break; } }
//Function to add a permaanent stat upgrade public void UpgradeStat(StatBuff newUpgrade) { //Get the stat modifier StatModifier newStatMod = newUpgrade.GetBuffModifier(); switch (newUpgrade.StatType) { case StatType.MaxHealth: //Add the modifier to health maxHealth.AddModifier(newStatMod); //Update the health UI setMaxHealthEvent.Raise((int)maxHealth.Value); break; case StatType.MaxMana: //Add the modifier to mana maxMana.AddModifier(newStatMod); //Update the mana UI setMaxManaEvent.Raise((int)maxMana.Value); break; case StatType.ManaRegen: //Add the modifier to mana regen manaRegen.AddModifier(newStatMod); break; case StatType.Strength: //Add the modifier to strength strength.AddModifier(newStatMod); break; case StatType.Speed: //Add the modifier to speed speed.AddModifier(newStatMod); break; case StatType.Magic: //Add the modifier to magic magic.AddModifier(newStatMod); break; } }
public void DmgCollision(float damage) { if (nextTimeCanGetDamage > Time.time) { return; } nextTimeCanGetDamage = Time.time + invulnerabilityTime; dmgTakenFlag = true; GameObject.Find("healthBackGround").GetComponent <SpriteRenderer>().color = invulnerabilityColor; StatModifier collisionDmg = new StatModifier(damage, StatModType.Flat); health.AddModifier(collisionDmg); GameObject.Find("healthSlider").GetComponent <HealthBarSlider>().ChangeLife(health.Value / health.BaseValue); if (health.Value <= 0) { gameObject.GetComponent <PlayerCollision>().knockBackEnd = 0; SceneManager.LoadScene("MainRoom", LoadSceneMode.Single); StatModifier healBack = new StatModifier(health.BaseValue, StatModType.Flat); health.AddModifier(healBack); GameObject.Find("healthSlider").GetComponent <HealthBarSlider>().ChangeLife(health.Value / health.BaseValue); // health.RemoveAllModifiersFromSource(health); } }
public void WoodenButterKnife() { Strength.AddModifier(new StatModifier(10, StatModType.Flat)); }
public void AddPercentMultModifier(CharacterStat statType, float statValue) { statType.AddModifier(new StatModifier(statValue, StatModType.PercentMult, this)); UpdateItemInfo(); player.UpdateStats(); }
/// <summary> /// Sets the permanent modifiers associated with a particular class/cloak /// </summary> private void SetStatModifiers() { _attack.AddModifier(AttackModifier); _defense.AddModifier(DefenseModifier); _health.AddModifier(HealthModifier); }