public void CheckInterruptAutoExplore() { if (bIdentified && GameObject.validate(ref Listener) && Listener.IsPlayer() && AutoAct.IsInterruptable() && !AutoAct.IsGathering() && Listener.IsRelevantHostile(base.Object)) { IComponent <GameObject> .AddPlayerMessage(Listener.GenerateSpotMessage(base.Object, null, "sense")); AutoAct.Interrupt(); } }
public override bool FireEvent(Event E) { if (E.ID == "BeginTakeAction") { if (Duration > 0) { if (base.Object.IsPlayer()) { IComponent <GameObject> .AddPlayerMessage("You are {{r|incapacitated}}."); } Duration--; return(false); } } else if (E.ID == "IsMobile" || E.ID == "IsConversationallyResponsive") { if (Duration > 0) { return(false); } } else if (E.ID == "CanChangeBodyPosition" || E.ID == "CanChangeMovementMode" || E.ID == "CanMoveExtremities") { if (Duration > 0 && !E.HasFlag("Involuntary")) { if (E.HasFlag("ShowMessage") && base.Object.IsPlayer()) { Popup.Show("You are {{R|incapacitated}}!"); } return(false); } } else if (E.ID == "BeforeDeepCopyWithoutEffects") { UnapplyStats(); } else if (E.ID == "AfterDeepCopyWithoutEffects") { ApplyStats(); } return(base.FireEvent(E)); }
public void TailStrike(XRL.World.GameObject Defender, int Hitbonus) { ThickTail Tail = base.ParentObject.Equipped.GetPart <Mutations>().GetMutation("ThickTail") as ThickTail; var TailSource = ParentObject; var Owner = TailSource.Equipped; Mutations HasSynergyMutation = Owner.GetPart <Mutations>(); if (Defender != null && Defender.PhaseAndFlightMatches(Owner) && Defender.CurrentCell != null && Owner.CurrentCell != null && Owner.DistanceTo(Defender) <= 1) { if (Defender.pBrain != null) { Defender.pBrain.GetAngryAt(Owner, -20); } if (Stat.Random(1, 20) + Hitbonus + Owner.StatMod("Agility", 0) > Stats.GetCombatDV(Defender)) { var data = Tail.GetData(Tail.Level); int PenetrationCont = Stat.RollDamagePenetrations(Stats.GetCombatAV(Defender), (Stat.Roll(data.Penetration, null) + Stat.Roll(data.BonusPen)), Stat.Roll(data.Penetration, null) + Stat.Roll(data.BonusPen)); string resultColor = Stat.GetResultColor(PenetrationCont); int DamageBaseInit = 0; if (PenetrationCont > 0) { for (int i = 0; i < PenetrationCont; i++) { DamageBaseInit += Stat.Roll(data.BaseDamage, null); CombatJuice.punch(Owner, Defender); } Damage damage = new Damage(DamageBaseInit); damage.AddAttribute("Physical"); damage.AddAttribute("Bludgeoning"); Event @event = Event.New("TakeDamage", 0, 0, 0); @event.AddParameter("Damage", damage); @event.AddParameter("Owner", Owner); @event.AddParameter("Attacker", Owner); if (HasSynergyMutation.HasMutation("Quills")) { @event.AddParameter("Damage", data.BonusDamage); } if (DamageBaseInit > 0 && Defender.FireEvent(@event)) { if (Owner.IsPlayer()) { IComponent <GameObject> .AddPlayerMessage(string.Concat(new string[] { "&gYou strike ", resultColor, "(x", PenetrationCont.ToString(), ")&y for ", damage.Amount.ToString(), " &ydamage with your " + base.ParentObject.DisplayName + "!" })); } else if (Defender.IsPlayer()) { IComponent <GameObject> .AddPlayerMessage(string.Concat(new string[] { ParentObject.The, ParentObject.ShortDisplayName, " &r", ParentObject.GetVerb("strike", false, false), " ", resultColor, "(x", PenetrationCont.ToString(), ")&r for ", damage.Amount.ToString(), " &ydamage with ", ParentObject.its, " tail!" })); } } else if (Owner.IsPlayer()) { IComponent <GameObject> .AddPlayerMessage("&rYou fail to deal damage to " + Defender.the + Defender.DisplayNameOnly + " &rwith your " + base.ParentObject.DisplayName + "!"); } else if (Defender.IsPlayer()) { IComponent <GameObject> .AddPlayerMessage(string.Concat(new string[] { ParentObject.The, ParentObject.DisplayName, " &g", ParentObject.GetVerb("fail", false, false), " to damage you with ", ParentObject.its, " tail!" })); } } } } }
public override bool FireEvent(Event E) { var Owner = ParentObject?.Equipped; if (Owner == null) { return(base.FireEvent(E)); } Mutations HasSynergyMutation = Owner.GetPart <Mutations>(); ThickTail TailMutation = base.ParentObject.Equipped.GetPart <Mutations>().GetMutation("ThickTail") as ThickTail; if (E.ID == "MutationAdded") { UpdateTailParts(); GameObject Tail = ParentObject; int Synergies = SynergyMutations.Count(HasSynergyMutation.HasMutation); if (Synergies == 3) { NeedsSynergyPrefix = false; Tail.DisplayName = "{{blue|bizarre}} tail"; } else if (Synergies == 4) { NeedsSynergyPrefix = false; Tail.DisplayName = "{{zetachrome|zenith}} tail"; } else if (Synergies >= 5) { NeedsSynergyPrefix = false; Tail.DisplayName = "{{shyrhak|chimeraen}} tail"; } } if (E.ID == "Equipped") { GameObject EventOwner = E.GetGameObjectParameter("EquippingObject"); EventOwner.RegisterPartEvent(this, "PerformingMeleeAttack"); EventOwner.RegisterPartEvent(this, "GetDefenderHitDice"); UpdateTailParts(); } else if (E.ID == "Unequipped") { GameObject EventOwner = E.GetGameObjectParameter("UnequippingObject"); EventOwner.UnregisterPartEvent(this, "PerformingMeleeAttack"); EventOwner.UnregisterPartEvent(this, "GetDefenderHitDice"); UpdateTailParts(); } if (E.ID == "PerformingMeleeAttack") { GameObject Defender = E.GetGameObjectParameter("Defender"); if (Stat.Random(1, 100) <= 20 + (TailMutation.Level * 5)) { TailStrike(Defender, 2 + TailMutation.Level); if (HasSynergyMutation.HasMutation("Quills")) { AddPlayerMessage("Your quilled tail delivers extra damage!"); } } } if (E.ID == "GetDefenderHitDice" && HasSynergyMutation.HasMutation("RoughScales")) { GameObject Attacker = E.GetGameObjectParameter("Attacker"); GameObject Tail = ParentObject; var TailShield = Tail.RequirePart <Shield>(); if (TailShield == null) { return(true); } if (E.HasParameter("ShieldBlocked")) { return(true); } if (!Owner.CanMoveExtremities(null, false, false, false)) { return(true); } if (Stat.Random(1, 100) <= 15 + (5 * TailMutation.Level)) { E.SetParameter("ShieldBlocked", true); if (Owner.IsPlayer()) { IComponent <GameObject> .AddPlayerMessage("You deflect an attack with your " + base.ParentObject.DisplayName + "!" + "(" + TailShield.AV + " AV)", 'g'); } else { Owner.ParticleText(string.Concat(new object[] { "{{", IComponent <GameObject> .ConsequentialColor(Owner, null), "|Block! (+", TailShield.AV, " AV)}}" }), ' ', false, 1.5f, -8f); } E.SetParameter("AV", E.GetIntParameter("AV", 0) + TailShield.AV); } } return(base.FireEvent(E)); }
public override bool FireEvent(Event E) { if (E.ID == "AttackerHit" && ParentObject.HasEffect("SaltBackStance")) { 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 { Damage.Amount = (int)Math.Round(Damage.Amount * 1.0f); } } catch { } } if (E.ID == "GetDefenderHitDice" && ParentObject.HasEffect("SaltbackStance")) { // AddPlayerMessage("SaltBack Defender Block Begins"); // GameObject Attacker = E.GetGameObjectParameter("Attacker"); var Owner = ParentObject; Body body = Owner.GetPart("Body") as Body; List <BodyPart> hands = body.GetPart("Hand"); var hand = body.GetPrimaryWeaponOfTypeOnBodyPartOfType("DefaultMartialFist", "Hand"); int FistShieldAV = ParentObject.StatMod("Toughness", 1) + (ParentObject.Statistics["Level"].BaseValue / 2); if (SpecialFistCollective.Any(Owner.HasEquippedObject)) { PSBArmorBonus = 3; } if (Owner.GetShield() != null) { // AddPlayerMessage("SaltBackHalf Shield Returned Null"); return(true); } if (E.HasParameter("ShieldBlocked")) { // AddPlayerMessage("SaltBackHalf Blocked ParameterSet"); return(true); } if (!Owner.CanMoveExtremities(null, false, false, false)) { // AddPlayerMessage("SaltBackHalf CanMove Check"); return(true); } // AddPlayerMessage("SaltBackHalf Block Attempt Random Int"); if (Stat.Random(1, 100) <= 15 + (5 * (ParentObject.Statistics["Level"].BaseValue / 5))) { // AddPlayerMessage("SaltBackHalf SaltBack Status"); var MMAComboAccess = ParentObject.GetPart <WM_MMA_CombinationStrikesI>(); E.SetParameter("ShieldBlocked", true); ++MMAComboAccess.CurrentComboICounter; MMAComboAccess.UpdateCounter(); // AddPlayerMessage("SaltBackHalf Damage"); if (Owner.IsPlayer()) { IComponent <GameObject> .AddPlayerMessage("You deflect an attack with your " + ParentObject.Equipped + "!" + "(" + FistShieldAV + " AV)", 'g'); } else { Owner.ParticleText(string.Concat(new object[] { "{{", IComponent <GameObject> .ConsequentialColor(Owner, null), "|Block! (+", FistShieldAV + " AV)}}" }), ' ', false, 1.5f, -8f); } E.SetParameter("AV", E.GetIntParameter("AV", 0) + FistShieldAV); } } return(base.FireEvent(E)); }
public override bool FireEvent(Event E) { if (E.ID == "AttackerHit" && ParentObject.HasEffect("DawnStance")) { if (ParentObject.HasPart("WM_MMA_SureStrikes")) { var MMAComboSSAccess = ParentObject.GetPart <WM_MMA_SureStrikes>(); //Handles damage scaling. if (BonusSureStrike <= 10) { ++BonusSureStrike; } MMAComboSSAccess.UpdateCounter(); } else { 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); } else if (salthopperDamageSystem.NegEffectsCollectiveTII.Any(Attacker.HasEffect)) { Damage.Amount = (int)Math.Round(Damage.Amount * 1.45f); } else if (salthopperDamageSystem.NegEffectsCollectiveTIII.Any(Attacker.HasEffect)) { Damage.Amount = (int)Math.Round(Damage.Amount * 2.5f); } else { Damage.Amount = (int)Math.Round(Damage.Amount * 1.0f); } } catch { } } } else if (E.ID == "CommandSureStrikes" && ParentObject.HasEffect("DawnStance")) { try { var MMAComboAccess = ParentObject.GetPart <WM_MMA_SureStrikes>(); MMAComboAccess.FistPenBonus = +BonusSureStrike; BonusSureStrike = 0; MMAComboAccess.UpdateCounter(); } catch { BonusSureStrike = 0; } } else if (E.ID == "CommandSureStrikes") { try { var MMAComboAccess = ParentObject.GetPart <WM_MMA_SureStrikes>(); MMAComboAccess.FistPenBonus = +BonusSureStrike; BonusSureStrike = 0; MMAComboAccess.UpdateCounter(); } catch { BonusSureStrike = 0; } } else if (E.ID == "PerformMeleeAttack" && ParentObject.HasEffect("DawnStance")) { int HitBonus = E.GetIntParameter("HitBonus"); HitBonus = +1; } if (E.ID == "GetDefenderHitDice" && ParentObject.HasEffect("DawnStance") && ParentObject.HasSkill("WM_MMA_PathSaltBack")) { // AddPlayerMessage("dawnSaltBack Defender Block Begins"); // GameObject Attacker = E.GetGameObjectParameter("Attacker"); var Owner = ParentObject; var SaltBackBlockSystem = ParentObject.GetPart <WM_MMA_PathSaltBack>(); Body body = Owner.GetPart("Body") as Body; List <BodyPart> hands = body.GetPart("Hand"); var hand = body.GetPrimaryWeaponOfTypeOnBodyPartOfType("DefaultMartialFist", "Hand"); int FistShieldAV = ParentObject.StatMod("Toughness", 1) + (ParentObject.Statistics["Level"].BaseValue / 4); if (SaltBackBlockSystem.SpecialFistCollective.Any(Owner.HasEquippedObject)) { SaltBackBlockSystem.PSBArmorBonus = 1; } if (Owner.GetShield() != null) { // AddPlayerMessage("SaltBackHalf Shield Returned Null"); return(true); } if (E.HasParameter("ShieldBlocked")) { // AddPlayerMessage("SaltBackHalf Blocked ParameterSet"); return(true); } if (!Owner.CanMoveExtremities(null, false, false, false)) { // AddPlayerMessage("SaltBackHalf CanMove Check"); return(true); } // AddPlayerMessage("SaltBackHalf Block Attempt Random Int"); if (Stat.Random(1, 100) <= 15 + (5 * (ParentObject.Statistics["Level"].BaseValue / 5))) { // AddPlayerMessage("SaltBackHalf SaltBack Status"); E.SetParameter("ShieldBlocked", true); // AddPlayerMessage("SaltBackHalf Damage"); if (Owner.IsPlayer()) { IComponent <GameObject> .AddPlayerMessage("You deflect an attack with your " + ParentObject.Equipped + "!" + "(" + FistShieldAV + " AV)", 'g'); } else { Owner.ParticleText(string.Concat(new object[] { "{{", IComponent <GameObject> .ConsequentialColor(Owner, null), "|Block! (+", FistShieldAV + " AV)}}" }), ' ', false, 1.5f, -8f); } E.SetParameter("AV", E.GetIntParameter("AV", 0) + FistShieldAV); } } if (E.ID == "BeginTakeAction" && ParentObject.HasEffect("DawnStance") && ParentObject.HasSkill("WM_MMA_PathAstralTabby")) { var ParentCell = ParentObject.CurrentCell.GetLocalAdjacentCells(); foreach (var C in ParentCell) { if (C.HasCombatObject()) { FlankersAboundBnsDuration = 7; StatShifter.SetStatShift("Speed", -2); } } } if (E.ID == "EndTurn" && ParentObject.HasEffect("DawnStance")) { if (FlankersAboundBnsDuration > 0) { --FlankersAboundBnsDuration; } else { StatShifter.RemoveStatShifts(); } var MMAComboAccess = ParentObject.GetPart <WM_MMA_SureStrikes>(); MMAComboAccess.UpdateCounter(); } return(base.FireEvent(E)); }