Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [ModifiesType]
- public class mod_StatusEffect : StatusEffect
- {
- [ModifiesMember("ApplyEffect")]
- private bool mod_ApplyEffect(GameObject target, float appliedValue)
- {
- this.m_restored = true;
- if (this.m_target == null)
- {
- this.m_target = target;
- if (this.m_target != null)
- {
- this.m_targetStats = this.m_target.GetComponent<CharacterStats>();
- }
- }
- if (!this.Params.CanApply((!(this.AbilityOrigin != null)) ? this.Owner : this.AbilityOrigin.gameObject, target, (!this.IsFromAura) ? this.m_target : this.Owner))
- {
- return false;
- }
- bool flag = this.Params.Apply == StatusEffect.ApplyType.ApplyOverTime || this.Params.Apply == StatusEffect.ApplyType.ApplyAtEnd || this.Params.IntervalRate != StatusEffectParams.IntervalRateType.None;
- if (this.m_applied && !flag && target == this.m_target)
- {
- return false;
- }
- if (this.IsSuppressed)
- {
- return false;
- }
- if (this.m_triggerCount > 0 && this.Params.TriggerAdjustment != null)
- {
- if (this.IsScaledMultiplier)
- {
- appliedValue *= (float)System.Math.Pow((double)this.Params.TriggerAdjustment.ValueAdjustment, (double)this.m_triggerCount);
- }
- else
- {
- appliedValue += this.Params.TriggerAdjustment.ValueAdjustment * (float)this.m_triggerCount;
- }
- }
- // PATCH START:
- // RELATED BUGS: #4
- // TASK: do not apply TransferDamageToCaster (like TakeTheHit) to non party members
- if (this.Params.AffectsStat == StatusEffect.ModifiedStat.TransferDamageToCaster && target != null)
- {
- GameObject animalCompanionMaster = GameUtilities.FindMaster(target);
- bool isPartyMember = PartyHelper.IsPartyMember(target);
- bool isPartyAnimalCompanion = animalCompanionMaster != null && PartyHelper.IsPartyMember(animalCompanionMaster);
- if (!isPartyMember && !isPartyAnimalCompanion)
- return false;
- }
- // PATCH END
- if (!this.ApplyEffectHelper(target, appliedValue))
- {
- return false;
- }
- this.m_applied = true;
- if (this.m_target == target)
- {
- this.m_effect_is_on_main_target = true;
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement