public override bool FireEvent(Event E) { if (E.ID == "AIGetOffensiveMutationList") { int intParameter = E.GetIntParameter("Distance"); if (intParameter <= 1 & IsMyActivatedAbilityCoolingDown(ActivatedAbilityID, ParentObject)) { GameObject gameObjectParameter2 = E.GetGameObjectParameter("Target"); if (gameObjectParameter2.PhaseAndFlightMatches(ParentObject)) { List <AICommandList> list = E.GetParameter("List") as List <AICommandList>; list.Add(new AICommandList("CommandSoulShunt", 1)); } } } if (E.ID == "DamageFromDecay") { int DegradateLevel = ParentObject.Stat("Level"); if (!ParentObject.MakeSave("Toughness", (28 + DegradateLevel), null, null, "Husk Deterioration")) { // StatShifter.SetStatShift(ParentObject, "Hitpoints", -Stat.Random(0, 3), true); ParentObject.Statistics["Hitpoints"].BaseValue -= Stat.Random(0, 3); } } else if (E.ID == "ApplyingTonic") { if (E.GetParameter <GameObject>("Tonic").Blueprint == "UbernostrumTonic" && SetCounterUberAptitude <= 0) { UbernostrumScaling = (int)Math.Round(Stat.Random(0.10f, 0.30f) * ParentObject.GetStatValue("Hitpoints", 1)); StatShifter.SetStatShift(ParentObject, "Hitpoints", UbernostrumScaling, true); SetCounterUberAptitude += 1; } else if (E.GetParameter <GameObject>("Tonic").Blueprint == "UbernostrumTonic" && SetCounterUberAptitude > 0) { UbernostrumScaling = (int)Math.Round(Stat.Random(0.10f, 0.30f) * ParentObject.GetStatValue("Hitpoints", 1)); UbernostrumScaling -= (int)Math.Round(UbernostrumScaling * (SetCounterUberAptitude + 0.10)); StatShifter.SetStatShift(ParentObject, "Hitpoints", UbernostrumScaling, true); SetCounterUberAptitude += 1; } } else if (E.ID == "EndTurn") { if (HuskWeakeningDuration > 0) { --HuskWeakeningDuration; if (HuskWeakeningDuration >= HuskWeakeningDuration * 0.7) { ParentObject.FireEvent(Event.New("DebuffsFromDecay")); } else if (HuskWeakeningDuration >= HuskWeakeningDuration * 0.3) { ParentObject.FireEvent(Event.New("DebuffsFromDecay")); } else if (HuskWeakeningDuration >= HuskWeakeningDuration * 0.1) { ParentObject.FireEvent(Event.New("DebuffsFromDecay")); } else if (HuskWeakeningDuration >= HuskWeakeningDuration * 0.05) { ParentObject.FireEvent(Event.New("DebuffsFromDecay")); } } else if (ParentObject.Statistics["Hitpoints"].BaseValue <= 1) { if (ParentObject.IsPlayer()) { ParentObject.Die(null, null, "As your husk crumbles to dust, so do your last tethers to world as your form radiates away.", Force: false); } } if (!ParentObject.HasEffect <Disintegrating>()) { ParentObject.ApplyEffect(new Disintegrating(9999)); } } else if (E.ID == "CommandSoulShunt") { ActivatedAbilities activatedAbilities = ParentObject.GetPart("ActivatedAbilities") as ActivatedAbilities; activatedAbilities.GetAbility(ActivatedAbilityID).Cooldown = 24000; SoulShunt(); var HuskCurrentToughness = ParentObject.Stat("Toughness"); HuskWeakeningDuration = 1200 * Math.Min(1, HuskCurrentToughness); } else if (E.ID == "DebuffsFromDecay") { var OwnersStrength = ParentObject.Stat("Strength"); var OwnersToughness = ParentObject.Stat("Toughness"); var OwnersAgility = ParentObject.Stat("Agility"); if (HuskWeakeningDuration >= HuskWeakeningDuration * 0.6) { } else if (HuskWeakeningDuration >= HuskWeakeningDuration * 0.5) { StatShifter.SetStatShift(ParentObject, "Strength", -((int)Math.Round(OwnersStrength * 0.2)), false); StatShifter.SetStatShift(ParentObject, "Toughness", -((int)Math.Round(OwnersToughness * 0.2)), false); StatShifter.SetStatShift(ParentObject, "Agility", -((int)Math.Round(OwnersAgility * 0.2)), false); } else if (HuskWeakeningDuration >= HuskWeakeningDuration * 0.3) { StatShifter.SetStatShift(ParentObject, "Strength", -((int)Math.Round(OwnersStrength * 0.4)), false); StatShifter.SetStatShift(ParentObject, "Toughness", -((int)Math.Round(OwnersToughness * 0.4)), false); StatShifter.SetStatShift(ParentObject, "Agility", -((int)Math.Round(OwnersAgility * 0.4)), false); } else if (HuskWeakeningDuration >= HuskWeakeningDuration * 0.1) { StatShifter.SetStatShift(ParentObject, "Strength", -((int)Math.Round(OwnersStrength * 0.6)), false); StatShifter.SetStatShift(ParentObject, "Toughness", -((int)Math.Round(OwnersToughness * 0.6)), false); StatShifter.SetStatShift(ParentObject, "Agility", -((int)Math.Round(OwnersAgility * 0.6)), false); } else if (HuskWeakeningDuration >= HuskWeakeningDuration * 0.05) { StatShifter.SetStatShift(ParentObject, "Strength", -((int)Math.Round(OwnersStrength * 0.8)), false); StatShifter.SetStatShift(ParentObject, "Toughness", -((int)Math.Round(OwnersToughness * 0.8)), false); StatShifter.SetStatShift(ParentObject, "Agility", -((int)Math.Round(OwnersAgility * 0.8)), false); } else if (HuskWeakeningDuration <= 0) { HuskWeakeningDuration = (int)Math.Round(HuskWeakeningDuration * 0.7); } } else if (E.ID == "SuccessfulDethroning") { GameObject OriginalBody = E.GetGameObjectParameter("OriginalBody"); var SkillAccess = OriginalBody.GetPart <Skills>(); var SkillListing = SkillAccess.SkillList; var CreatureTier = OriginalBody.GetTier(); var PrimaryFaction = OriginalBody.GetPrimaryFaction(); var FactionVar = Factions.get(PrimaryFaction); var NewBodyPrimaryFaction = OriginalBody.GetPrimaryFaction(); var ParentIntelligenceSkillAward = (ParentObject.BaseStat("Intelligence") - 10) * 4; ParentObject.FireEvent(Event.New("EntityHasSwappedBodies")); if (!ParentObject.HasSkill("Survival")) { ParentObject.AddSkill("Survival"); if (!ParentObject.HasSkill("Survival_Camp")) { ParentObject.AddSkill("Survival_Camp"); } } foreach (var k in SkillListing) { ParentObject.GetStat("SP").BaseValue += ParentIntelligenceSkillAward; } if (FactionVar.Visible) { try { XRL.Core.XRLCore.Core.Game.PlayerReputation.modify(PrimaryFaction, -CreatureTier * 50, true); } catch { return(true); } } if (OriginalBody != null) { // AddPlayerMessage("Original Body: " + OriginalBody + "."); // AddPlayerMessage("Parent Body: " + ParentObject + "."); if (!ParentObject.HasProperName) { ParentObject.DisplayName = OriginalBody.DisplayNameOnly; OriginalBody.DisplayName = Names.NameMaker.MakeName(ParentObject); } else { var NewName = ParentObject.DisplayNameOnly; ParentObject.DisplayName = OriginalBody.DisplayNameOnly; OriginalBody.DisplayName = NewName; } OriginalBody.GetAngryAt(ParentObject, -100); PlayWorldSound("soulshunt"); var DifferenceVar = ParentObject.StatMod("Ego") - OriginalBody.StatMod("Ego"); DifferenceVar *= 5; if (Stat.Random(1, 100) <= DifferenceVar && IsPlayer()) { if (Popup.ShowYesNo("You feel the remnants of tender light pulsating within your new husk, would you like to imprint these codings upon your own animus?", false, DialogResult.Yes) == DialogResult.Yes) { StatShifter.SetStatShift(ParentObject, "Ego", 1, true); } else { Popup.Show("You cast the remnants away."); } } } } return(base.FireEvent(E)); }