public override bool HandleEvent(GetSwimmingPerformanceEvent E) { GameObject Tail = ParentObject; GameObject Owner = Tail.Equipped; Mutations PMu = Owner.GetPart <Mutations>(); ThickTail TailMutation = base.ParentObject.Equipped.GetPart <Mutations>().GetMutation("ThickTail") as ThickTail; var data = TailMutation.GetData(TailMutation.Level); if (PMu.HasMutation("Amphibious")) { E.MoveSpeedPenalty -= data.SwimSpeed; } return(base.HandleEvent(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!" })); } } } } }