protected void AddStatusEffect(StatusEffect se) { statusEffects.Add(se); CalculateStats(); }
/// <summary> /// Adds a status effect to the monster /// </summary> /// <param name="seName"> Name of the statusEffect </param> /// <param name="seDuration"> Duration of the statusEffect </param> /// <param name="c"> Character afflicting the statusEffect on this character, can be null for some effects </param> public void AddStatusEffect(StatusEffectConstant seName, int seDuration, Character c) { if (CanBeStatusEffected() == true) { if (seName == StatusEffectConstant.RBW) // for archer's cursed roots, rbw randomly chooses { int index = Random.Range(0, 3); switch (index) { case 0: seName = StatusEffectConstant.BLEED; break; case 1: seName = StatusEffectConstant.WEAKNESS; break; case 2: seName = StatusEffectConstant.ROOT; break; default: break; } } int existingIndex = GetStatusEffect(seName); if (existingIndex != -1) // reapply the status effect if its already applied { seToRemove.Add(statusEffects[existingIndex]); RemoveStatusEffectsNoCalculate(); // will be recalculating anyways on AddStatusEffect } StatusEffect newStatus; if (c != null && c.ID == this.ID && CombatManager.instance.inCombat == true) { newStatus = new StatusEffect(seName, seDuration + 1); // status effects proc the same turn they show up, so to keep the duration equal between all characters, add 1 if selfinduced } else { newStatus = new StatusEffect(seName, seDuration); } newStatus.SetValue(c, this); AddStatusEffect(newStatus); md.AddStatusEffectDisplay(newStatus); UpdateStatusEffectValues(); md.UpdateTooltip(); // update the tooltip last in case a status effect changes PDEF or MDEF when combined with another if (seName == StatusEffectConstant.STUN) { PartyManager.instance.TriggerSkillEnabled(ClassConstants.ROGUE, (int)SkillConstants.RogueSkills.AMBUSHER, c); } if (GameManager.instance.gsDataCurrent.achievementsUnlocked[(int)achievementConstants.ANTIMASKERS] == false) { if (statusEffects.Count >= 5) { GameManager.instance.gsDataCurrent.achievementsUnlocked[(int)achievementConstants.ANTIMASKERS] = true; EventManager.instance.SetAchievementNotification((int)achievementConstants.ANTIMASKERS); } } } }
/// <summary> /// Tell partyMemberDisplay to add a statusEffect /// </summary> /// <param name="se"></param> public void AddStatusEffectDisplay(StatusEffect se) { pmdPartyPanel.AddStatusEffectDisplay(se); }
/// <summary> /// Applies a champion buff to a monster at random /// TODO: Make AddStatusEffectPermanent similar to AddStatusEffect /// </summary> /// <param name="championBuffs"> List of championBuffs that can be applied in the subArea (assumed length 3) </param> public void GetChampionBuff(string[] championBuffs) { if (multiplier == 4) // boss monsters can only be champion if GetBossBuff() allows it (otherwise too op) { isChampion = Random.Range(0, 100) < championChance; } else { isChampion = Random.Range(0, 100) < (championChance + PartyManager.instance.bonusChampionChance); } if (isChampion == true) { multiplier += 0.5f; this.EXP = (int)((Mathf.Pow(LVL, 1.65f) + ((STR + DEX + INT + LUK) / 10)) * this.multiplier * (1 / difficultyModifier)); this.WAX = (int)(Mathf.Pow(LVL + 1, 1.65f) * this.multiplier * (1 / difficultyModifier)); monsterReward.UpgradeResult(); dropChance = 100; StatusEffectConstant championBuff = (StatusEffectConstant)Enum.Parse(typeof(StatusEffectConstant), championBuffs[Random.Range(0, championBuffs.Length)]); StatusEffect newStatus; switch (championBuff) { case StatusEffectConstant.CHAMPIONATK: { if (PATK >= MATK) { newStatus = new StatusEffect(StatusEffectConstant.CHAMPIONPATK, 999); } else { newStatus = new StatusEffect(StatusEffectConstant.CHAMPIONMATK, 999); } AddStatusEffectPermanent(newStatus); md.AddStatusEffectDisplay(newStatus); break; } case StatusEffectConstant.CHAMPIONDEF: { if (PDEF >= MDEF) { newStatus = new StatusEffect(StatusEffectConstant.CHAMPIONPDEF, 999); } else { newStatus = new StatusEffect(StatusEffectConstant.CHAMPIONMDEF, 999); } AddStatusEffectPermanent(newStatus); md.AddStatusEffectDisplay(newStatus); break; } case StatusEffectConstant.CHAMPIONHP: { newStatus = new StatusEffect(StatusEffectConstant.CHAMPIONHP, 999); newStatus.SetValue(this, this); AddStatusEffectPermanent(newStatus); md.AddStatusEffectDisplay(newStatus); break; } } } }