public void ChainingSureStrike(GameObject Target) { // AddPlayerMessage("Chaining Strikes Method Fires"); PlayWorldSound("swiftstrikes", 0.5f, 0, true); // AddPlayerMessage("chaining eventhook?"); Event EventHook = null; var PrimaryWeapon = ParentObject.GetPrimaryWeapon(); var PrimaryWeaponTraits = PrimaryWeapon.GetPart <MeleeWeapon>(); FistPenBonus = PrimaryWeaponTraits.PenBonus; PrimaryWeaponTraits.AdjustBonusCap(FistPenBonus * 2); // AddPlayerMessage("event changes"); EventHook = Event.New("PerformMeleeAttack", 0, 0, 0); EventHook.SetParameter("PenBonus", FistPenBonus * 2); EventHook.SetParameter("PenCapBonus", ParentObject); EventHook.SetParameter("Attacker", ParentObject); EventHook.SetParameter("Defender", Target); // AddPlayerMessage("fire eventhook?"); ParentObject.FireEvent(EventHook); var eAttacker = Target; var MMAAccess = ParentObject.GetPart <WM_MMA_CombinationStrikesI>(); ChainFuntion(); if (IsPlayer()) { UpdateCounter(); } }
public override void HundredTurnTick(long TurnNumber) { try {// AddPlayerMessage("This is Working: Sorta"); Body pBody = ParentObject.GetPart("Body") as Body; if (pBody != null) { BodyPart Part = pBody.GetPartByManager(AdditionsManagerID); if (Part != null) { ParentObject.FireEvent(Event.New("CommandForceUnequipObject", "BodyPart", Part)); if (BaseTail == null) { BaseTail = GameObject.create("BaseThickTail"); } Armor armor = BaseTail.GetPart("Armor") as Armor; armor.WornOn = Part.Type; Event @event = Event.New("CommandForceEquipObject"); @event.SetParameter("Object", BaseTail); @event.SetParameter("BodyPart", Part); @event.SetSilent(Silent: true); ParentObject.FireEvent(@event); } } } catch { } }
public override bool FireEvent(Event E) { if (E.ID == "MutationAdded") { Body pBody = ParentObject.GetPart("Body") as Body; if (pBody != null) { BodyPart Part = pBody.GetPartByManager(AdditionsManagerID); if (Part != null) { ParentObject.FireEvent(Event.New("CommandForceUnequipObject", "BodyPart", Part)); if (BaseTail == null) { BaseTail = GameObject.create("BaseThickTail"); } Armor armor = BaseTail.GetPart("Armor") as Armor; armor.WornOn = Part.Type; Event @event = Event.New("CommandForceEquipObject"); @event.SetParameter("Object", BaseTail); @event.SetParameter("BodyPart", Part); @event.SetSilent(Silent: true); ParentObject.FireEvent(@event); } } if (ParentObject.HasObjectInInventory("BaseThickTail")) { ParentObject.FindObjectInInventory("BaseThickTail").Destroy(null, true, false); } } return(base.FireEvent(E)); }
public override bool FireEvent(Event E) { if (E.ID == "GetInventoryActions") { E.GetParameter <EventParameterGetInventoryActions>("Actions").AddAction("Smoke", 's', false, "&Ws&ymoke", "InvCommandSmoke"); } else if (E.ID == "InvCommandSmoke") { SmokeThis(E.GetGameObjectParameter("Owner"), true); E.RequestInterfaceExit(); if (Effect != null) { Effect effect = Activator.CreateInstance(ModManager.ResolveType("XRL.World.Effects." + Effect)) as Effect; if (!string.IsNullOrEmpty(Duration)) { effect.Duration = Stat.Roll(Duration); } GameObject parameter = E.GetGameObjectParameter("Owner"); parameter.ApplyEffect(effect); } ParentObject.FireEvent(Event.New("DestroyObject")); } return(base.FireEvent(E)); }
public bool EndConstriction(GameObject Target, Event E = null, Constricted TargetEffect = null) { if (Target == null) { Constricted = null; return(true); } if (TargetEffect == null) { TargetEffect = (Target.GetEffect("Constricted") as Constricted); if (TargetEffect == null) { Constricted = null; return(true); } } if (TargetEffect.ConstrictedBy != ParentObject) { Constricted = null; return(true); } Target.RemoveEffect(TargetEffect); Target.UseEnergy(1000, "Position"); Target.FireEvent(Event.New("Exited", "Object", ParentObject)); Cell TargetsAdjacentPosition = Target.CurrentCell.GetRandomLocalAdjacentCell(); // Target.DirectMoveTo(TargetsAdjacentPosition, 1000, true); ParentObject.FireEvent(Event.New("ObjectExited", "Object", Target)); if (E != null) { E.RequestInterfaceExit(); } Constricted = null; return(true); }
public override void HundredTurnTick(long TurnNumber) { DecayingFormDurationCycle -= 100; if (DecayingFormDurationCycle <= 0) { ParentObject.FireEvent(Event.New("DamageFromDecay")); DecayingFormDurationCycle = 600; } }
public override bool FireEvent(Event E) { if (E.ID == "Equipped") { GameObject GO = E.GetGameObjectParameter("EquippingObject"); acegiak_Ridable ridable = new acegiak_Ridable(); if (this.AltTile != null) { ridable.AltTile = this.AltTile; } GO.AddPart(ridable); } else if (E.ID == "Unequipped") { GameObject GO = E.GetGameObjectParameter("UnequippingObject");; GO.RemovePart <acegiak_Ridable>(); } // else if (E.ID == "GetInventoryActions") // { // E.GetParameter<EventParameterGetInventoryActions>("Actions").AddAction("Harness", 'H', true, "&WH&yarness a creature", "InvCommandHarness", 10); // } // else if (E.ID == "Dropped") // { // GameObject taking = E.GetGameObjectParameter("DroppingObject"); // taking.UnregisterPartEvent(this,"InvCommandHarness"); // } // else if (E.ID == "AddedToInventory") // { // GameObject taking = E.GetGameObjectParameter("TakingObject"); // taking.RegisterPartEvent(this,"InvCommandHarness"); // } if (E.ID == "ProjectileHit" || E.ID == "ThrownProjectileHit" || E.ID == "WeaponAfterDamage") { GameObject defender = E.GetGameObjectParameter("Defender"); GameObject attacker = E.GetGameObjectParameter("Attacker"); if (E.GetIntParameter("Penetrations", 0) > 0 && !IsBroken() && !IsRusted()) { if (defender != null && defender.baseHitpoints >= 1) { ParentObject.FireEvent(Event.New("InvCommandHarness", "Owner", defender, "Attacker", attacker)); } } } if (E.ID == "InvCommandHarness") { GameObject defender = E.GetGameObjectParameter("Owner"); GameObject attacker = E.GetGameObjectParameter("Attacker"); Harness(attacker, defender); } return(base.FireEvent(E)); }
public override bool FireEvent(Event E) { if (E.ID == "CommandManifestLimb") { ArmCost = (2 + ArmCounter) + (2 * ArmCounter) - 1; NewArmCost = ArmCost; FocusPsi focusPsi = ParentObject.GetPart <FocusPsi>(); if (NewArmCost <= ParentObject.Statistics["PsiCharges"].BaseValue) { ArmCounter += 1; focusPsi.focusPsiCurrentCharges = focusPsi.maximumPsiCharge(); AddPsionicArms(); AddPlayerMessage(ParentObject.It + " manifest psionic limbs."); UseEnergy(500); focusPsi.UpdateCharges(); ParentObject.FireEvent(Event.New("FireEventDebuffSystem", 0, 0, 0)); } else if (NewArmCost <= ParentObject.Statistics["PsiCharges"].BaseValue || ParentObject.Statistics["PsiCharges"].BaseValue <= 0) { AddPlayerMessage(ParentObject.It + " do not have enough {{red|maximum charges}} to materialize a new limb."); return(true); } } if (E.ID == "CommandDismissLimb") { FocusPsi focusPsi = ParentObject.GetPart <FocusPsi>(); if (ArmCounter >= 1) { focusPsi.UpdateCharges(); RemovePsionicArms(); AddPlayerMessage(ParentObject.It + " dismiss " + ParentObject.its + " psionic arms."); ArmCounter -= 1; ParentObject.FireEvent(Event.New("FireEventDebuffSystem", 0, 0, 0)); } } if (E.ID == "Dismember") { if (E.HasStringParameter("Psionic") || E.HasIntParameter("17")) { AddPlayerMessage("{{Red|A blow disrupts the tangibility of one of " + ParentObject.its + " arms, it dissipates!}}"); string ArmInQuestion = E.GetStringParameter("LimbSourceGameObjectID"); ParentObject.RemoveBodyPartsByManager(ArmInQuestion, EvenIfDismembered: true); } } if (E.ID == "EndTurn") { FocusPsi focusPsi = ParentObject.GetPart <FocusPsi>(); focusPsi.UpdateCharges(); // AddPlayerMessage("ArmCounter: " + ArmCounter); // AddPlayerMessage("CurrentID: " + ManagerID + ArmCounter); // AddPlayerMessage("ArmCost: " + ArmCost); // AddPlayerMessage("PsiMaximum: " + focusPsi.maximumPsiCharge()); // AddPlayerMessage("PsiArmCounter: " + focusPsi.ArmCounter); // AddPlayerMessage("PsiArmcost: " + focusPsi.ArmCost); } return(base.FireEvent(E)); }
public override bool FireEvent(Event E) { if (E.ID == "BeforeApplyDamage") { Damage parameter = E.GetParameter("Damage") as Damage; if (parameter.HasAttribute("Slashing")) { parameter.Amount = (int)((double)parameter.Amount * (0.25 * (int)Math.Ceiling((Decimal)Level / new Decimal(2)))); } else if (parameter.HasAttribute("Melee")) { parameter.Amount = (int)((double)parameter.Amount * (0.25 * (int)Math.Ceiling((Decimal)Level / new Decimal(2)))); } else if (parameter.HasAttribute("Ranged")) { parameter.Amount = (int)((double)parameter.Amount * (1 + (0.25 * (int)Math.Ceiling((Decimal)Level / new Decimal(2))))); } if (ParentObject.CurrentCell != null && parameter.Amount != 0) { List <Cell> adjacentCells1 = ParentObject.CurrentCell.GetAdjacentCells(true); adjacentCells1.Add(ParentObject.CurrentCell); foreach (Cell cell in adjacentCells1) { if (!cell.IsOccluding() && Stat.Random(1, 100) >= 90) { GameObject IchorContainer = GameObject.create(this.PoisonIchorObj); cell.AddObject(IchorContainer); } } } } if (E.ID == "Regenerating") { nRegrowCount++; if (nRegrowCount >= nNextLimb) { nRegrowCount = 0; nNextLimb = 1000 - 400 * base.Level + Stat.Roll("1d" + ((11 - Math.Min(base.Level, 10)) * 1000).ToString()); ParentObject.FireEvent(Event.New("RegenerateLimb", 0, 0, 0)); } E.AddParameter("Amount", E.GetIntParameter("Amount") + (20 + base.Level * 4)); return(true); } return(base.FireEvent(E)); }
public void ReturnPsiWeapon() { Zone ParentsCurrentZone = ParentObject.CurrentZone; if (ParentsCurrentZone.findObjectById(PsiWeaponsID) != null) { GameObject PsiWeaponInZone = ParentsCurrentZone.findObjectById(PsiWeaponsID); var ParentsEquippableSlot = ParentObject.Body.GetPrimaryLimbType(); var ParentsBodySlots = ParentObject.Body.GetBody(); var ParentsInventory = ParentObject.Inventory; var ParentsHands = ParentsBodySlots.GetPartByName("Hand"); PlayWorldSound("return"); PsiWeaponInZone.CurrentCell.Splash("{{M|*}}"); ParentsInventory.AddObject(PsiWeaponInZone, true, true, true); // PsiWeaponInZone.EquipObject(ParentObject, ParentsEquippableSlot, true); var WeaponInInvo = ParentsInventory.GetObjects(); foreach (var O in WeaponInInvo) { if (O.id == PsiWeaponsID) { if (ParentObject.Body.HasPrimaryHand()) { // AddPlayerMessage("Return getting Obj in Prime for: " + O); XDidY(O, "suddenly appear", "in " + ParentObject.its + " " + ParentsEquippableSlot, "!", null, ParentObject); O.ForceEquipObject(ParentObject, ParentsEquippableSlot, true); Event @event = Event.New("CommandForceEquipObject"); @event.SetParameter("Object", PsiWeaponInZone); @event.SetParameter("BodyPart", ParentsHands); @event.SetSilent(Silent: true); ParentObject.FireEvent(@event); } else { // AddPlayerMessage("Dismissing getting Obj in Inv for: " + O); XDidY(O, "suddenly appear", "in " + ParentObject.its + " inventory", "!", null, ParentObject); } } } } else { AddPlayerMessage("Your weapon is not returnable at this time."); } }
public void ThrowSureStrike(Cell cell) { // var TargetCell = ParentObject.PickDirection(); var PrimaryWeapon = ParentObject.GetPrimaryWeapon(); Event EventHook = null; GameObject Target = cell.FindObject(o => o.HasPart("Brain")); if (cell == null) { AddPlayerMessage("Must target an enemy!"); return; } if (IsPlayer() && Target == null) { AddPlayerMessage("Invalid Target."); return; } // if (IsPlayer() && Target != null && !PrimaryWeapon.HasPart("MartialConditioningFistMod") || !PrimaryWeapon.HasPart("MartialConditioningFistMod")) // { // AddPlayerMessage("Invalid Weapon type."); // return; // } // AddPlayerMessage("passed clears, throwing attack"); PlayWorldSound("swiftstrikes", 0.5f, 0, true); var PrimaryWeaponTraits = PrimaryWeapon.GetPart <MeleeWeapon>(); var FistPenBonus = PrimaryWeaponTraits.PenBonus; EventHook = Event.New("PerformMeleeAttack", 0, 0, 0); EventHook.SetParameter("PenBonus", FistPenBonus + 20); EventHook.SetParameter("Attacker", ParentObject); EventHook.SetParameter("TargetCell", cell); EventHook.SetParameter("Defender", Target); eDefender = Target; AddPlayerMessage(ParentObject.it + " throws focused, percussive strikes at " + eDefender.it); ParentObject.FireEvent(EventHook); UpdateCounter(); // ParentObject.PerformMeleeAttack(Target); }
public void AddBodyPart() { string gtype = ParentObject.GetTag("GlandLiquid"); if (gtype != null) { //IPart.AddPlayerMessage("glandtype:"+gtype); this.GlandType = gtype; } Body part = ParentObject.GetPart <Body>(); if (part != null) { BodyPart body = part.GetBody(); if (body.GetFirstPart("Glands") != null) { return; } BodyPart firstPart = body.AddPart(new BodyPart("Glands", part), "Back"); GameObject GlandsObject = GameObjectFactory.Factory.CreateObject("DefaultGlands"); GlandsObject.DisplayName = GlandType + " glands"; GlandsObject.GetPart <LiquidProducer>().Liquid = GlandType; GlandsObject.GetPart <LiquidVolume>().Empty(); GlandsObject.GetPart <LiquidVolume>().InitialLiquid = GlandType + "-1000"; GlandsObject.GetPart <LiquidVolume>().Volume = GlandsObject.GetPart <LiquidVolume>().StartVolume.RollCached(); //GlandsObject.GetPart<acegiak_NoPour>().ProcessInitialLiquid(GlandType-"1000"); Event @event = Event.New("CommandForceEquipObject"); @event.AddParameter("Object", GlandsObject); @event.AddParameter("BodyPart", firstPart); @event.SetSilent(true); ParentObject.FireEvent(@event); } }
public override bool FireEvent(Event E) { if (E.ID == "BeforeApplyDamage") { Damage parameter = E.GetParameter("Damage") as Damage; if (parameter.HasAttribute("Slashing")) { parameter.Amount = (int)((double)parameter.Amount * (0.25 * (int)Math.Ceiling((Decimal)Level / new Decimal(2)))); } else if (parameter.HasAttribute("Melee")) { parameter.Amount = (int)((double)parameter.Amount * (0.25 * (int)Math.Ceiling((Decimal)Level / new Decimal(2)))); } else if (parameter.HasAttribute("Ranged")) { parameter.Amount = (int)((double)parameter.Amount * (1 + (0.25 * (int)Math.Ceiling((Decimal)Level / new Decimal(2))))); } if (ParentObject.CurrentCell != null && parameter.Amount != 0) { List <Cell> adjacentCells1 = ParentObject.CurrentCell.GetAdjacentCells(true); adjacentCells1.Add(ParentObject.CurrentCell); foreach (Cell cell in adjacentCells1) { if (!cell.IsOccluding() && Stat.Random(1, 100) <= 10 + (5 * Level / 2)) { GameObject AcidContainer = GameObject.create(this.acidPool); cell.AddObject(AcidContainer, true, false, false, false, null); } } } } else if (E.ID == "EndTurn") { Cell Cell = ParentObject.CurrentCell; if (IsDissolving == true && (Cell.HasObject(X => WaterThatHurts.Contains(X.Blueprint)))) { this.Duration += 2; Damage += 1; ParentObject.TakeDamage(ref Damage, null, "{{green|Dissolved into visceral soup.}}", null, null, null, Message: "from salt diffusion!"); } } else if (E.ID == "Regenerating") { nRegrowCount++; if (nRegrowCount >= nNextLimb) { nRegrowCount = 0; nNextLimb = 1000 - 400 * base.Level + Stat.Roll("1d" + ((11 - Math.Min(base.Level, 10)) * 1000).ToString()); ParentObject.FireEvent(Event.New("RegenerateLimb", 0, 0, 0)); } E.AddParameter("Amount", E.GetIntParameter("Amount") + (20 + base.Level * 4)); return(true); } else if (E.ID == "CommandSpitAcid") { if (!this.ParentObject.pPhysics.CurrentCell.ParentZone.IsWorldMap()) { List <Cell> list = PickBurst(1, 8, false, AllowVis.OnlyVisible); if (list == null) { return(true); } foreach (Cell item in list) { if (item.DistanceTo(ParentObject) > 9) { if (ParentObject.IsPlayer()) { Popup.Show("That is out of range! (8 squares)"); } return(true); } } if (list != null) { SlimeGlands.SlimeAnimation("&G", ParentObject.CurrentCell, list[0]); CooldownMyActivatedAbility(ActivatedAbilityID, 40); int num = 0; foreach (Cell item2 in list) { if (num == 0 || Stat.Random(1, 100) <= 80) { item2.AddObject(GameObject.create("AcidPool")); } num++; } UseEnergy(1000); } } } return(base.FireEvent(E)); }
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)); }
public override bool FireEvent(Event E) { if (E.ID == "CommandApplyInjector") { // Exit if frozen if (!ParentObject.CheckFrozen()) { if (ParentObject.IsPlayer()) { Popup.Show("You are frozen!"); } return(false); } // get all injectors, or exit if none Body BodyObj = ParentObject.GetPart <Body>(); List <GameObject> Injectors = BodyObj == null ? null : BodyObj.GetEquippedObjects(InjectorFilter); if (Injectors == null || Injectors.Count == 0) { if (ParentObject.IsPlayer()) { Popup.Show("Equip at least one usable injector in a hand!"); } return(false); } // check if valid target Cell Cell = PickDirection(); if (Cell != null) { // Get all valid targets, respecting phasing/flying/light List <GameObject> Targets = Cell.GetObjectsWithPartReadonly("Brain"); // Remove hostile targets Targets.RemoveAll(T => T.pBrain.IsHostileTowards(ParentObject)); if (Targets.Count == 0) { if (ParentObject.IsPlayer()) { Popup.Show("No valid target!"); } return(false); } // We have a valid target! Check if in combat. GameObject Target = Targets[0]; foreach (GameObject Injector in Injectors) { if (Target.AreHostilesNearby()) // Make a attack against DV before injecting { // Lifted from Combat.cs int Roll = Stat.Random(1, 20); int BaseRoll = Roll; // we don't include movement bonuses in this roll since it's an ability activation Roll += ParentObject.GetIntProperty("HitBonus", 0); if (Injector != null) { Roll += Injector.GetIntProperty("HitBonus", 0); } int AgilityMod = ParentObject.StatMod("Agility"); Roll += AgilityMod; Event RollEvent = Event.New("RollMeleeToHit"); RollEvent.AddParameter("Weapon", Injector); RollEvent.AddParameter("Damage", 0); RollEvent.AddParameter("Defender", Target); RollEvent.AddParameter("Result", Roll); RollEvent.AddParameter("Skill", "ShortBlades"); RollEvent.AddParameter("Stat", "Agility"); Injector?.FireEvent(RollEvent); RollEvent.ID = "AttackerRollMeleeToHit"; Injector?.FireEvent(RollEvent); Roll = RollEvent.GetIntParameter("Result"); Event DVEvent = Event.New("GetDefenderDV"); DVEvent.AddParameter("Weapon", Injector); DVEvent.AddParameter("Damage", 0); DVEvent.AddParameter("Defender", Target); DVEvent.AddParameter("NaturalHitResult", BaseRoll); DVEvent.AddParameter("Result", Roll); DVEvent.AddParameter("Skill", "ShortBlades"); DVEvent.AddParameter("Stat", "Agility"); DVEvent.AddParameter("DV", Stats.GetCombatDV(Target)); Target.FireEvent(DVEvent); DVEvent.ID = "WeaponGetDefenderDV"; Injector?.FireEvent(DVEvent); // for masterwork mod, plus natural attacker/defender bonuses/penalties int NaturalHitBonus = 0; Event NaturalHitBonusEvent = Event.New("GetNaturalHitBonus", "Result", NaturalHitBonus); Injector.FireEvent(NaturalHitBonusEvent); NaturalHitBonusEvent.ID = "AttackerGetNaturalHitBonus"; ParentObject.FireEvent(NaturalHitBonusEvent); NaturalHitBonusEvent.ID = "DefenderGetNaturalHitBonus"; Target.FireEvent(NaturalHitBonusEvent); NaturalHitBonus = NaturalHitBonusEvent.GetIntParameter("Result"); if (BaseRoll + NaturalHitBonus < 20 && Roll <= DVEvent.GetIntParameter("DV")) // no autohit { // Chance to fumble, dropping the injector string Color = "&r"; int Diff = DVEvent.GetIntParameter("DV") - Roll; if (Stat.Random(1, 20) + AgilityMod <= Diff) { // fumble!!! if (ParentObject.IsPlayer()) { IPart.AddPlayerMessage(Color + "You miss, dropping the " + Injector.DisplayName + "!"); } ParentObject.FireEvent(Event.New("Unequipped", "UnequippingObject", Injector)); Event UnequipEvent = Event.New("PerformDrop", "Object", Injector); UnequipEvent.bSilent = E.bSilent; ParentObject.FireEvent(UnequipEvent); } else { if (ParentObject.IsPlayer()) { IPart.AddPlayerMessage(Color + "You miss with the " + Injector.DisplayName + "!"); } } continue; } } IPart.AddPlayerMessage("&gYou apply the " + Injector.DisplayName + " to " + Target.ShortDisplayName + "!"); // no hostiles or didn't miss - fire the injector Injector.FireEvent(Event.New("ApplyTonic", "Target", Target, "Attacker", ParentObject)); Injector.Destroy((string)null, false, false); } // Deal with energy cost - reduced by short blades skill int EnergyCost = 1000; if (ParentObject.HasSkill("ShortBlades_Expertise")) { EnergyCost = 750; } ParentObject.UseEnergy(EnergyCost, "Physical Skill"); return(true); } } return(false); }
public bool Constrict(GameObject Target, Event E = null) { // AddPlayerMessage("Phase: initialize constrict"); CheckConstricted(); if (Constricted != null) { EndConstriction(Constricted, null, null); if (Constricted != null) { // AddPlayerMessage("Phase: end constrict"); return(false); } } // AddPlayerMessage("Phase: 1"); // !Target.CanChangeMovementMode("Constricted", false, true, false) if (!Target.CanChangeBodyPosition("Constricted", false, true, false)) { if (ParentObject.IsPlayer()) { Popup.Show(string.Concat(new string[] { "You cannot do that while ", Target.the, Target.ShortDisplayName, "&y", Target.Is, " in ", Target.its, " present situation." }), true); } return(false); } // AddPlayerMessage("Phase: 2"); if (!Target.PhaseAndFlightMatches(ParentObject)) { return(false); } // AddPlayerMessage("Phase: 3"); if (Target.SameAs(ParentObject)) { return(false); } // AddPlayerMessage("Phase: 4"); Cell currentCell = ParentObject.pPhysics.CurrentCell; // AddPlayerMessage("Phase: 5"); if (currentCell == null) { return(false); } // Save vs constriction // AddPlayerMessage("Phase: 6"); if (ResistanceSave(Target)) { // AddPlayerMessage("Phase: 6a"); if (ParentObject.IsPlayer()) { // AddPlayerMessage("Phase: 6b"); Popup.Show("You fail to constrict " + Target.the + Target.ShortDisplayName + ".", true); } else if (Target.IsPlayer()) { // AddPlayerMessage("Phase: 7"); IPart.AddPlayerMessage(string.Concat(new string[] { ParentObject.The, ParentObject.ShortDisplayName, "&y", ParentObject.GetVerb("try", true, false), " to wrap around and constrict you, but", ParentObject.GetVerb("fail", true, false), "." })); } else if (IPart.Visible(ParentObject)) { // AddPlayerMessage("Phase: 8"); IPart.AddPlayerMessage(string.Concat(new string[] { ParentObject.The, ParentObject.ShortDisplayName, "&y", ParentObject.GetVerb("try", true, false), " to wrap around and constrict ", Target.the, Target.ShortDisplayName, "&y, but", ParentObject.GetVerb("fail", true, false), "." })); } // CheckEnterDamage(Target, true); ParentObject.UseEnergy(1000, "Position"); if (E != null) { // AddPlayerMessage("Phase: 9"); E.RequestInterfaceExit(); } return(false); } if (Target.CurrentCell != currentCell && !ParentObject.DirectMoveTo(Target.CurrentCell, 0, true, true)) { // AddPlayerMessage("Phase: 10"); if (E != null) { // AddPlayerMessage("Phase: 11"); E.RequestInterfaceExit(); } return(false); } // AddPlayerMessage("Phase: 12"); // CheckEnterDamage(Target, false); string verb = "are"; string preposition = "constricted by"; GameObject parentObject = ParentObject; XDidYToZ(Target, verb, preposition, parentObject, null, null); Constricted = Target; Target.ApplyEffect(new Constricted(ParentObject), null); ParentObject.UseEnergy(1000, "Position"); ParentObject.FireEvent(Event.New("Constricted", "Object", Target)); Target.FireEvent(Event.New("ObjectConstricted", "Object", ParentObject)); if (E != null) { E.RequestInterfaceExit(); } return(true); }
public bool Kiss(GameObject who) { if (!hasPart(ParentObject, "face")) { if (who.IsPlayer()) { Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&y doesn't have a face."); } return(true); } if (!hasPart(who, "face")) { if (who.IsPlayer()) { Popup.Show("You don't have a face."); } return(true); } string beguiled = ""; string hbeguiled = " &Mkissed you back&y."; if (ParentObject.GetIntProperty("BeguilingBonusApplied") > 0) { beguiled = "\n" + ParentObject.It + ParentObject.GetVerb("quake") + " with fear and manic ecstasy."; hbeguiled = " could not resist."; } else { if (kissableIfPositiveFeeling && ParentObject.pBrain.GetFeeling(who) < 55) { if (who.IsPlayer()) { Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&y" + ParentObject.GetVerb("shy") + " away from you."); } ParentObject.pBrain.AdjustFeeling(who, -5); if (ParentObject.pBrain.GetFeeling(who) < 0) { Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&Y is upset by your advances!"); } return(true); } if (!isAttractedTo(who)) { if (who.IsPlayer()) { Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&Y isn't attracted to you."); } ParentObject.pBrain.AdjustFeeling(who, -10); if (ParentObject.pBrain.GetFeeling(who) < 0) { Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&Y is upset by your advances!"); } return(true); } } if (ParentObject.GetPart <acegiak_Romancable>() != null) { if (ParentObject.GetPart <acegiak_Romancable>().patience <= 0) { ParentObject.pBrain.AdjustFeeling(who, -5); Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&Y doesn't want to kiss you right now."); if (ParentObject.pBrain.GetFeeling(who) < 0) { Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&Y is upset by your advances!"); } } ParentObject.GetPart <acegiak_Romancable>().patience--; } string verb = "kiss"; GameObject parentObject = ParentObject; IPart.XDidYToZ(who, verb, parentObject, null, null, true); if (who.IsPlayer()) { if (ParentObject.HasPropertyOrTag("SpecialKissResponse")) { Popup.Show(ParentObject.GetTag("SpecialKissResponse")); } else { KissBuff(who); Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&y " + ParentObject.GetPropertyOrTag("KissResponse", "&Mkisses you back") + "." + beguiled); JournalAPI.AddAccomplishment("&y You kissed " + ParentObject.a + ParentObject.DisplayNameOnlyDirect + " and " + ParentObject.it + hbeguiled, "general", null, -1L); } } ParentObject.Heartspray(); who.UseEnergy(1000, "Kissing"); ParentObject.FireEvent(Event.New("ObjectKissed", "Object", ParentObject, "Kisser", who)); return(true); }
public override bool FireEvent(Event E) { if (E.ID == "AIGetOffensiveMutationList") { int parameter1 = (int)E.GetParameter("Distance"); GameObject parameter2 = E.GetParameter("Target") as GameObject; List <AICommandList> parameter3 = (List <AICommandList>)E.GetParameter("List"); if (this.SWForceChokeActivatedAbility != null && this.SWForceChokeActivatedAbility.Cooldown <= 0 && parameter1 <= this.GetRange(this.Level) && this.ParentObject.HasLOSTo(parameter2)) { parameter3.Add(new AICommandList("CommandSWForceChoke", 1)); } return(true); } if (E.ID == "CommandStopSWForceChoke") { ChokedObject.FireEvent(Event.New("StopChoking")); return(true); } if (E.ID == "CommandSWForceChoke") { Cell C = this.PickDestinationCell(this.GetRange(this.Level), AllowVis.OnlyVisible, true); if (C == null) { return(true); } //Check range if (C.DistanceTo((this.ParentObject.GetPart("Physics") as Physics).CurrentCell) > this.GetRange(this.Level)) { if (this.ParentObject.IsPlayer()) { Popup.Show("That is out of range! (" + this.GetRange(this.Level) + " squares)", true); } return(true); } //Check free hand Body body = this.ParentObject.GetPart("Body") as Body; bool HasEmptyHand = false; if (body != null) { List <BodyPart> hands = body.GetPart("Hand"); foreach (BodyPart hand in hands) { if (hand._Equipped == null) { HasEmptyHand = true; partName = hand.Name;//Records the free hand break; } } } if (!HasEmptyHand && !AllowFullHand) { if (this.ParentObject.IsPlayer()) { Popup.Show("You must have a free hand without any equipment to do a force gesture!", true); } return(true); } if (C != null) { this.SWForceChokeActivatedAbility.Cooldown = this.GetCooldown(Level) * 10 + 10; this.SW_Choke(C); //Cost 0 energy because the mandatory ForceGetureEquip already cost 1000 ParentObject.FireEvent(Event.New("UseEnergy", "Amount", 0, "Type", "Mental Mutation ForceChoke")); } } return(true); }
public override bool FireEvent(Event E) { //... if (E.ID == "Regenerating" && ParentObject.HasEffect("Submerged")) { int RegenerationAmountParameter = E.GetIntParameter("Amount"); RegenerationAmountParameter += (int)Math.Ceiling((float)RegenerationAmountParameter); E.SetParameter("Amount", RegenerationAmountParameter); } else if (E.ID == "BeginMove" && ParentObject.HasEffect("Submerged")) { Cell Cell = E.GetParameter("DestinationCell") as Cell; if (((!Cell.HasObjectWithPart("LiquidVolume") || (Cell.GetFirstObjectWithPart("LiquidVolume") as GameObject).LiquidVolume.Volume < 200) && ParentObject.IsPlayer() && ParentObject.HasEffect("Submerged"))) { if (Popup.ShowYesNo("Surface and go ashore?") == (int)DialogResult.Yes) { ParentObject.Splash("{{b|*}}"); ParentObject.RemoveEffect("Submerged"); } else { return(false); } } } else if (E.ID == "DiveCommand") { Cell Cell = ParentObject.GetCurrentCell(); Mutations ParentsMutations = ParentObject.GetPart <Mutations>(); if (ParentObject.HasEffect("Flying")) { if (IsPlayer()) { AddPlayerMessage("You cannot do this while flying"); } return(false); } else if (!Cell.HasObjectWithPart("LiquidVolume")) { AddPlayerMessage("You try to dive into the earth, you imagine this would be easier if the ground were, say, just a tad less hard."); return(false); } else if ((Cell.GetFirstObjectWithPart("LiquidVolume") as GameObject).LiquidVolume.Volume < 200) { AddPlayerMessage("Its too shallow to dive in!"); return(false); } else if (ParentObject.HasEffect("Submerged")) { // AddPlayerMessage("Your return to the surface."); ParentObject.Splatter("{{B|*}}"); ParentObject.RemoveEffect("Submerged"); } else if ((Cell.GetFirstObjectWithPart("LiquidVolume") as GameObject).LiquidVolume.Volume >= 200 && ParentsMutations.HasMutation("Amphibious")) { AddPlayerMessage("You feel right at home."); ParentObject.Splatter("{{B|*}}"); ParentObject.ApplyEffect(new Submerged(Duration: Effect.DURATION_INDEFINITE)); } else if ((Cell.GetFirstObjectWithPart("LiquidVolume") as GameObject).LiquidVolume.Volume >= 200 && !ParentsMutations.HasMutation("Amphibious")) { ParentObject.Splatter("{{B|*}}"); ParentObject.ApplyEffect(new Submerged(Duration: Effect.DURATION_INDEFINITE)); } } else if (E.ID == "EndTurn") { Cell Cell = ParentObject.GetCurrentCell(); if (ParentObject.HasEffect("Flying") && (ParentObject.HasEffect("Submerged"))) { ParentObject.RemoveEffect(new Flying()); AddPlayerMessage("Removing Paradox Incident."); } else if (ParentObject.IsHealingPool() && ParentObject.HasEffect("Submerged")) { ParentObject.Heal(+ParentObject.Statistics["Toughness"].Modifier); } else if (((!Cell.HasObjectWithPart("LiquidVolume") || (Cell.GetFirstObjectWithPart("LiquidVolume") as GameObject).LiquidVolume.Volume < 200) && ParentObject.HasEffect("Submerged"))) { ParentObject.Splash("{{b|*}}"); ParentObject.RemoveEffect("Submerged"); return(false); } } //...--------------------------------------------------------------------------------------------- else if (E.ID == "DeepStrikeCommand") { if (!ParentObject.HasEffect("Submerged") && ParentObject.IsPlayer()) { AddPlayerMessage("You must be submerged in deep pools of liquid to use this attack."); } else if (!ParentObject.HasEffect("Submerged") && !ParentObject.IsPlayer()) { } else if (ParentObject.HasEffect("Submerged")) { string Direction = E.GetStringParameter("Direction"); if (Direction == null) { if (ParentObject != null) { Direction = PickDirectionS(); try { Patch_PhaseAndFlightMatches.TemporarilyDisabled = true; Event e = Event.New("CommandAttackDirection", "Direction", Direction); bool num11 = FireEvent(e); ParentObject.FireEvent(e); XDidY(ParentObject, "rush", "from the depths to strike!", "!", "C", ParentObject); Patch_PhaseAndFlightMatches.TemporarilyDisabled = false; } catch { } } } } } else if (E.ID == "AIGetOffensiveMutationList") { //AddPlayerMessage("I'mma keel yo ass."); if (IsMyActivatedAbilityAIUsable(DiveActivatedAbility)) { if (!ParentObject.HasEffect("Submerged") && (ParentObject.CurrentCell.GetFirstObjectWithPart("LiquidVolume") as GameObject).LiquidVolume.Volume >= 200) { E.AddAICommand("DiveCommand"); } } int intParameter = E.GetIntParameter("Distance"); if (E.GetGameObjectParameter("Target") != null && intParameter <= 1 && !ParentObject.IsFrozen() && IsMyActivatedAbilityAIUsable(DeepStrikeActivatedAbility)) { E.AddAICommand("DeepStrikeCommand"); } } else if (E.ID == "BeginTakeAction") { if (ParentObject.HasEffect("Flying") && (ParentObject.HasEffect("Submerged"))) { ParentObject.RemoveEffect(new Flying()); AddPlayerMessage("Removing Paradox Incident."); } } return(base.FireEvent(E)); }
public void DismissPsiWeapon() { Zone ParentsCurrentZone = ParentObject.CurrentZone; if (ParentsCurrentZone.findObjectById(PsiWeaponsID) != null && !ParentObject.HasObjectInInventory(PsiWeaponsID) || !ParentObject.HasEquippedObject(PsiWeaponsID)) { // AddPlayerMessage("Dismissing Weapon"); GameObject PsiWeaponInZone = ParentsCurrentZone.findObjectById(PsiWeaponsID); // AddPlayerMessage("Finding: " + PsiWeaponsID); var ParentsInventory = ParentObject.Inventory; var WeaponInInvo = ParentsInventory.GetObjects(); var ParentsBodySlots = ParentObject.Body.GetBody(); var ParentsHands = ParentsBodySlots.GetPartByName("Hand"); ParentObject.FireEvent(Event.New("CommandForceUnequipObject", "BodyPart", ParentsHands)); if (ParentsBodySlots.IsItemEquippedOnLimbType(PsiWeaponInZone, "Hand")) { // AddPlayerMessage("Dismissing getting Obj in Hands for: " + PsiWeaponInZone); PsiWeaponInZone.ForceUnequipAndRemove(true); ParentsInventory.RemoveObject(PsiWeaponInZone); XDidY(PsiWeaponInZone, "disappear", null, null, null, null); if (WeaponCounter > 0) { --WeaponCounter; } } else if (ParentsInventory.HasObject(PsiWeaponInZone)) { ParentsInventory.RemoveObject(PsiWeaponInZone); // AddPlayerMessage("Dismissing getting Obj in inv for: " + PsiWeaponInZone); if (WeaponCounter > 0) { --WeaponCounter; } } else if (ParentsCurrentZone.findObjectById(PsiWeaponsID) != null) { if (PsiWeaponInZone.CurrentCell != null) { DidX("disappear", null, null, null, null, PsiWeaponInZone); PsiWeaponInZone.CurrentCell.Splash("{{M|*}}"); PsiWeaponInZone.Destroy(); if (WeaponCounter > 0) { --WeaponCounter; } } } else { AddPlayerMessage("There are no weapons to dismiss."); } } else { AddPlayerMessage("There are no weapons to dismiss."); } }
public override bool FireEvent(Event E) { if (E.ID == "AttackerHit" && ParentObject.HasEffect("SlumberStance")) { try { var salthopperDamageSystem = ParentObject.GetPart <WM_MMA_PathSaltHopper>(); Damage Damage = E.GetParameter <Damage>("Damage"); var Attacker = ParentObject; if (salthopperDamageSystem.NegEffectsCollectiveTI.Any(Attacker.HasEffect)) { Damage.Amount = (int)Math.Round(Damage.Amount * 1.15f); } if (salthopperDamageSystem.NegEffectsCollectiveTII.Any(Attacker.HasEffect)) { Damage.Amount = (int)Math.Round(Damage.Amount * 1.55f); } if (salthopperDamageSystem.NegEffectsCollectiveTIII.Any(Attacker.HasEffect)) { Damage.Amount = (int)Math.Round(Damage.Amount * 2.5f); } else { } } catch { } } else if (E.ID == "AttackerAfterAttack" && ParentObject.HasEffect("SlumberStance")) { // AddPlayerMessage("Execute Attacker hit on Slumberstyle"); Damage Damage = E.GetParameter <Damage>("Damage"); var Attacker = ParentObject; var Defender = E.GetGameObjectParameter("Defender"); var Weapon = E.GetGameObjectParameter("Weapon"); Event E2 = Event.New("SlumberCleaveEvent"); E2.SetParameter("Attacker", ParentObject); E2.SetParameter("Defender", Defender); E2.SetParameter("Damage", Damage.Amount); ParentObject.FireEvent(E2); } else if (E.ID == "SlumberCleaveEvent" && ParentObject.HasEffect("SlumberStance")) { GameObject Attacker = E.GetGameObjectParameter("Attacker"); GameObject Defender = E.GetGameObjectParameter("Defender"); int DamageAmount = E.GetParameter <int>("Damage"); int ParentsStr = ParentObject.Statistics["Strength"].Modifier; // AddPlayerMessage("var check 1"); var AttackerLevels = Attacker.Statistics["Level"].BaseValue; // AddPlayerMessage("var check 2"); var AttackerCell = Attacker.GetCurrentCell(); var AttackersAdacentCells = AttackerCell.GetLocalAdjacentCells(); // AddPlayerMessage("slumberstyle initiated vars"); string[] directionList = Directions.DirectionList; foreach (string direction3 in directionList) { GameObject Flankers = ParentObject.GetCurrentCell().GetCellFromDirection(direction3)?.GetCombatTarget(ParentObject, AllowInanimate: false); if (Stat.Random(1, 100) <= 3 + AttackerLevels / 3) { // AddPlayerMessage("Dismember is Firing?"); var FlankersBody = Flankers.Body.GetParts(); foreach (var ob in FlankersBody) { if (Stat.Random(1, 100) <= 2 + (AttackerLevels / 10) && ob.IsSeverable() && ob.ParentBody != ParentObject.Body) { if (ob.AnyMortalParts() || ob.Mortal) { if (ob.Type == "Head") { ob.Dismember(); Flankers.Die(ParentObject, ParentObject.it + " lob " + Flankers.its + ob.Name + ", killing it!", null); } else if (ob.Type == "Body") { ob.Dismember(); Flankers.Die(ParentObject, ParentObject.it + "obliterates" + Flankers.its + ob.Name + ", killing it!", null); } } } else if (ob.IsSeverable() && ob.Appendage && !ob.Mortal && ob.ParentBody != ParentObject.Body) { ob.Dismember(); } } } if (Stat.Random(1, 100) <= 25 + AttackerLevels / 3) { // AddPlayerMessage("Push is firing?"); Flankers.TakeDamage(ref (DamageAmount)); RageStrikePulse(Flankers.CurrentCell); Flankers.Push(direction3, 1000, 1); } } } else if (E.ID == "SlumberWitnessEvent" && ParentObject.HasEffect("SlumberStance")) { // AddPlayerMessage("slumberstarting for each 2"); var Attacker = E.GetGameObjectParameter("Attacker"); var Defender = E.GetGameObjectParameter("Defender"); var AttackerLevels = Attacker.Statistics["Level"].BaseValue; var CheckCells = Attacker.CurrentCell.GetLocalAdjacentCells(); var CellQuery = CheckCells.Where(C => C.HasObjectWithTagOrProperty("Brain") || C.HasObjectWithTagOrProperty("Combat") && C.HasCombatObject() && !C.HasObject(Attacker)); foreach (var c2 in CellQuery) { // AddPlayerMessage("slumberstarting for each 3"); var FrightenedFlankers = c2.GetObjectsInCell(); var FrightQuery = FrightenedFlankers.Where(Obj => !Obj.MakeSave("Ego", 20 + (AttackerLevels / 3), Attacker, "Ego", "Ego", false) && Obj != Attacker && Obj.HasPart("Brain") || Obj.HasPart("Combat")); foreach (var o2 in FrightenedFlankers) { // AddPlayerMessage("slumberstarting for each 4"); string text = (int)Math.Floor((double)(AttackerLevels / 2) + 3.0) + "d6"; int num = ParentObject.StatMod("Ego"); o2.pBrain.Goals.Clear(); o2.pBrain.PushGoal(new Flee(Attacker, 5 + (AttackerLevels / 2), false)); // AddPlayerMessage(o2.The + " flees in horror of " + Attacker.Its + " torrent of rage."); } } } else if (E.ID == "PerformMeleeAttack" && ParentObject.HasEffect("SlumberStance")) { int HitBonus = E.GetIntParameter("HitBonus"); HitBonus = +1; } // if (E.ID == "EndTurn" && ParentObject.HasEffect("SlumberStance")) // { // AddPlayerMessage(" "); // } return(base.FireEvent(E)); }
public void Ticks() { if (stage < 1) { return; } if (!this.Dead) { long newGrowth = (XRLCore.Core.Game.TimeTicks - this.lastseen); if (this.lastseen == 0) { newGrowth = 0; } this.lastseen = XRLCore.Core.Game.TimeTicks; //IPart.AddPlayerMessage("tickcheck:"+this.growth.ToString()+"+"+newGrowth.ToString()+"="+(this.growth+newGrowth).ToString()); this.growth += newGrowth; if (this.growth >= stageLength) { //IPart.AddPlayerMessage((growth/stageLength).ToString()+" plant growth ticks!"); for (int i = 0; i < growth / stageLength; i++) { Tick(); } this.growth = this.growth % stageLength; tileupdate(); } } if (this.stage >= 5 && !this.Dead) { Cell cell = ParentObject.CurrentCell; if (cell == null) { Popup.Show("Things must grow in the ground."); return; } GameObject growInto = GameObject.create(Result); if (GetPuddle() != null) { if (GetPuddle().ComponentLiquids.ContainsKey(acegiak_LiquidRestrainingAgent.ID)) { growInto.pPhysics.Takeable = true; growInto.pPhysics.Weight = growInto.pPhysics.Weight / 10; growInto.pRender.DisplayName += " bonsai"; } } if (GetPuddle() != null) { if (GetPuddle().ComponentLiquids.ContainsKey(acegiak_LiquidFurlingAgent.ID)) { GameObject furled = GameObject.create("FurledPlant"); furled.GetPart <Render>().DisplayName = "Furled " + growInto.DisplayNameOnly; furled.GetPart <Render>().DetailColor = ParentObject.pRender.DetailColor; furled.GetPart <Render>().TileColor = ParentObject.pRender.TileColor; furled.GetPart <Render>().RenderString = ParentObject.pRender.RenderString; furled.GetPart <Render>().ColorString = ParentObject.pRender.ColorString; furled.GetPart <DeploymentGrenade>().Blueprint = growInto.Blueprint; growInto = furled; } } if (GetPuddle() != null) { if (GetPuddle().ComponentLiquids.ContainsKey(acegiak_LiquidSoothingAgent.ID)) { if (growInto.GetPart <Brain>() != null) { growInto.GetPart <Brain>().PerformReequip(); growInto.GetPart <Brain>().BecomeCompanionOf(growInto.ThePlayer); growInto.GetPart <Brain>().IsLedBy(growInto.ThePlayer); growInto.GetPart <Brain>().SetFeeling(growInto.ThePlayer, 100); growInto.GetPart <Brain>().Goals.Clear(); growInto.GetPart <Brain>().Calm = false; growInto.GetPart <Brain>().Hibernating = false; growInto.GetPart <Brain>().FactionMembership.Clear(); growInto.AddPart(new Combat()); } } } if (growInto.GetPart <Brain>() != null) { XRLCore.Core.Game.ActionManager.AddActiveObject(growInto); } cell.AddObject(growInto); ParentObject.FireEvent(new Event("acegiak_SeedGrow", "From", ParentObject, "To", growInto)); cell.RemoveObject(ParentObject); ParentObject.Destroy("matured", true, true); } }
public override bool FireEvent(Event E) { if (E.ID == "AIGetOffensiveMutationList") { int intParameter = E.GetIntParameter("Distance"); GameObject gameObjectParameter = E.GetGameObjectParameter("Target"); List <AICommandList> list = (List <AICommandList>)E.GetParameter("List"); if (pActivatedAbility != null && !ParentObject.AreHostilesAdjacent() && pActivatedAbility.Cooldown <= 0 && intParameter > 3 && !ParentObject.AreHostilesAdjacent() && intParameter < 6 + ParentObject.GetIntProperty("LungeRangeModifier") && ParentObject.HasLOSTo(gameObjectParameter)) { List <Cell> list2 = PickLine(2, AllowVis.OnlyVisible); if (list2 == null) { return(true); } if (list2.Count != 2) { return(true); } for (int i = 0; i < list2.Count; i++) { foreach (GameObject item in list2[i].LoopObjectsWithPart("Combat")) { if (ParentObject.HasPart("Brain") && ParentObject.GetPart <Brain>().GetFeeling(item) >= 0) { return(true); } } } list.Add(new AICommandList("CommandAcegiakPolearmLunge", 1)); } return(true); } if (E.ID == "CommandAcegiakPolearmLunge") { if (!IsPrimaryPolearmEquipped()) { if (ParentObject.IsPlayer()) { Popup.Show("You must have a polearm equipped to Polearm Lunge."); } return(true); } if (ParentObject.OnWorldMap()) { if (ParentObject.IsPlayer()) { Popup.Show("You cannot Lunge on the world map."); } return(true); } if (ParentObject.pPhysics != null && ParentObject.pPhysics.IsFrozen()) { Popup.Show("You are frozen solid!"); return(true); } List <Cell> list3 = PickLine(2, AllowVis.OnlyVisible, ValidLungeTarget); if (list3 == null) { return(true); } int num = 3; int num2 = 2; if (list3.Count != num) { if (IsPlayer()) { Popup.Show("You must Lunge 2 spaces."); } return(false); } if (!list3[list3.Count - 1].HasObjectWithPart("Combat")) { if (IsPlayer()) { Popup.Show("You must Lunge at a target!"); } return(false); } Physics pPhysics = ParentObject.pPhysics; string text = ParentObject.pRender.ColorString + ParentObject.pRender.RenderString; if (ParentObject.IsPlayer()) { list3.RemoveAt(0); } int num3 = 10; foreach (Cell item2 in list3) { List <GameObject> objectsWithPart = item2.GetObjectsWithPart("Combat"); if (objectsWithPart.Count > 0) { if (objectsWithPart[0].IsPlayer()) { IPart.AddPlayerMessage("&R" + ParentObject.The + ParentObject.DisplayName + " &R" + ParentObject.GetVerb("lunge", PrependSpace: false) + " you!"); } if (ParentObject.DistanceTo(item2) == 2) { ParentObject.FireEvent(Event.New("CommandAttackCell", "Cell", item2, "Properties", "Lunging")); } pActivatedAbility.Cooldown = 0; ParentObject.FireEvent(Event.New("LungedTarget", "Defender", objectsWithPart[0])); objectsWithPart[0].FireEvent(Event.New("WasLunged", "Attacker", ParentObject)); return(true); } } } return(base.FireEvent(E)); }
public override bool FireEvent(Event E) { LiquidVolume liquidVolume = ParentObject.GetPart <LiquidVolume>(); if (liquidVolume.Volume < 1000 && !liquidVolume.ContainsSignificantLiquid("water")) { return(false); } if (E.ID == "CanSmartUse") { if (!CheckRod(E.GetGameObjectParameter("User"))) { return(false); } if ((!E.GetGameObjectParameter("User").IsPlayer() || !ParentObject.IsPlayerLed()) && !liquidVolume.IsFreshWater()) { return(false); } } else if (E.ID == "CanHaveSmartUseConversation") { if (!CheckRod(E.GetGameObjectParameter("User"))) { return(false); } if (!liquidVolume.IsFreshWater()) { return(false); } } else if (E.ID == "CommandSmartUse") { if (!CheckRod(E.GetGameObjectParameter("User"))) { return(false); } if (!E.GetGameObjectParameter("User").IsPlayer() || !ParentObject.IsPlayerLed()) { ParentObject.FireEvent(new Event("InvCommandFish", "Owner", E.GetGameObjectParameter("User"))); } } else if (E.ID == "GetInventoryActions") { if (!CheckRod(XRLCore.Core.Game.Player.Body)) { return(false); } E.GetParameter <EventParameterGetInventoryActions>("Actions").AddAction("Fish", 'f', false, "&Wf&yish", "InvCommandFish", 10); } if (E.ID == "InvCommandFish") { if (E.GetGameObjectParameter("Owner").IsPlayer()) { IPart.AddPlayerMessage("You cast a line."); // IPart.AddPlayerMessage("Water in "+ParentObject.pPhysics.CurrentCell.ParentZone.DisplayName); // IPart.AddPlayerMessage("Water in "+ParentObject.pPhysics.CurrentCell.ParentZone.BaseDisplayName); // IPart.AddPlayerMessage("Water in "+ParentObject.pPhysics.CurrentCell.ParentZone.ReferenceDisplayName); // IPart.AddPlayerMessage("Water in "+ParentObject.pPhysics.CurrentCell.ParentZone.NameContext); } E.GetGameObjectParameter("Owner").FireEvent(Event.New("StartFishing", "Pool", ParentObject, "Fisher", E.GetGameObjectParameter("User"))); Fish(E.GetGameObjectParameter("Owner")); E.RequestInterfaceExit(); } if (E.ID == "InvCommandContinueFish") { Fish(E.GetGameObjectParameter("Owner"), E.GetIntParameter("Count")); } return(base.FireEvent(E)); }
public override bool FireEvent(Event E) { if (E.ID == "BeginTakeAction") { CheckConstricted(); if (Constricted != null && !ParentObject.pBrain.HasGoal("FleeLocation")) { ParentObject.pBrain.Goals.Clear(); } } else if (E.ID == "ObjectEnteredAdjacentCell") { GameObject gameObjectParameter = E.GetGameObjectParameter("Object"); if (gameObjectParameter != null && ParentObject.pBrain.IsHostileTowards(gameObjectParameter)) { CheckConstricted(); if (Constricted == null && !gameObjectParameter.MakeSave("Strength", 20, null, null, "Constrictment")) { Constrict(gameObjectParameter, null); } } } else if (E.ID == "EnteredCell") { if (Constricted != null) { if (ParentObject.CurrentCell != null) { if (Constricted.CurrentCell != null && Constricted.CurrentCell != ParentObject.CurrentCell) { Constricted.CurrentCell.RemoveObject(Constricted); } if (!ParentObject.CurrentCell.Objects.Contains(Constricted)) { ParentObject.CurrentCell.AddObject(Constricted); } } Constricted.FireEvent(Event.New("ConstrictDragged", "Object", ParentObject)); ParentObject.FireEvent(Event.New("ConstricterDragged", "Object", Constricted)); } CheckConstricted(); } else if (E.ID == "BeginBeingTaken") { EndAllConstriction(); } else if (E.ID == "AIGetOffensiveMutationList") { CheckConstricted(); if (Constricted == null) { int intParameter = E.GetIntParameter("Distance"); ActivatedAbilityEntry ActivatedAbility = MyActivatedAbility(ActivatedAbilitiesID); if (ActivatedAbility != null && ActivatedAbility.Cooldown <= 0 && intParameter <= 1) { GameObject gameObjectParameter2 = E.GetGameObjectParameter("Target"); if (gameObjectParameter2.PhaseAndFlightMatches(ParentObject)) { List <AICommandList> list = E.GetParameter("List") as List <AICommandList>; list.Add(new AICommandList("CommandConstrict", 1)); } } } } // Allows both player and AI to direction a cell to activate the mutation on else if (E.ID == "CommandConstrict") { // AddPlayerMessage("Phase: check frozen"); if (!ParentObject.CheckFrozen()) { return(true); } CheckConstricted(); Cell cell = base.PickDirection(null); // AddPlayerMessage("Phase: CooldownSet"); if (cell != null) { CooldownMyActivatedAbility(ActivatedAbilitiesID, 15); } { GameObject combatTarget = cell.GetCombatTarget(ParentObject, false, false, false, null, true, true, false, null); // AddPlayerMessage("Phase: Combat target grabbed"); if (combatTarget != null && combatTarget != ParentObject) { if (Constricted != null) { // AddPlayerMessage("Phase: end constrict"); EndConstriction(Constricted, null, null); } // AddPlayerMessage("Phase: start constrict"); Constrict(combatTarget, null); } } } return(base.FireEvent(E)); }