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!"
                            }));
                        }
                    }
                }
            }
        }
コード例 #2
0
        public override bool FireEvent(Event E)
        {
            //Debug.Log("Event: "+E.ID+".");

            if (E.ID == "StartFishing")
            {
                //Debug.Log("startfishevent.");
                //Popup.Show("You cast a line.");
                fishinHole = E.GetGameObjectParameter("Pool");
            }
            if (E.ID == "StopFishing")
            {
                //Debug.Log("stopfishevent.");

                if (fishinHole != null)
                {
                    IPart.AddPlayerMessage("You stop fishing.");
                }
                fishinHole = null;
            }
            if (E.ID == "UsingEnergy")
            {
                //IPart.AddPlayerMessage("use energy.");
                //IPart.AddPlayerMessage(E.GetStringParameter("Type", string.Empty));

                if (E.GetStringParameter("Type", string.Empty) == "Pass" || E.GetStringParameter("Type", string.Empty) == string.Empty || E.GetStringParameter("Type", string.Empty) == "Fishing" || E.GetStringParameter("Type", string.Empty) == "None")
                {
                    //Debug.Log("passturn.");
                    if (fishinHole != null)
                    {
                        if (fishinHole.GetPart <acegiak_Fishable>().Epic != null)
                        {
                            IPart.AddPlayerMessage("The line goes slack.");
                        }
                        fishinHole.GetPart <acegiak_Fishable>().fromCell = null;
                        fishinHole.GetPart <acegiak_Fishable>().Epic     = null;
                        fishinHole.FireEvent(Event.New("InvCommandContinueFish", "Owner", ParentObject, "Count", ++turnCount));
                    }
                }
                else
                {
                    //Debug.Log("notfish.");

                    if (fishinHole != null)
                    {
                        //Debug.Log("stopfish.");

                        if (fishinHole.GetPart <acegiak_Fishable>() == null || fishinHole.GetPart <acegiak_Fishable>().Epic == null)
                        {
                            IPart.AddPlayerMessage("You stop fishing.");
                            fishinHole = null;
                        }
                        else
                        {
                            if (fishinHole.GetPart <acegiak_Fishable>().Epic.HasStat("Strength") && fishinHole.GetPart <acegiak_Fishable>().Epic.MakeSave("Strength", 1, ParentObject, "Strength"))
                            {
                                if (ParentObject.CurrentCell != fishinHole.GetPart <acegiak_Fishable>().fromCell)
                                {
                                    CombatJuice.punch(fishinHole.GetPart <acegiak_Fishable>().fromCell.location, ParentObject.CurrentCell.location);
                                    fishinHole.GetPart <acegiak_Fishable>().fromCell.AddObject(ParentObject);
                                    //ParentObject.CurrentCell = fishinHole.GetPart<acegiak_Fishable>().fromCell;
                                    IPart.AddPlayerMessage("You strain at the line!");
                                }
                            }
                            else
                            {
                                Popup.Show("You reel in " + fishinHole.GetPart <acegiak_Fishable>().Epic.the + fishinHole.GetPart <acegiak_Fishable>().Epic.DisplayNameOnly + ".");
                                fishinHole.GetPart <acegiak_Fishable>().Epic.AwardXPTo(ParentObject, false, "Catch");
                                fishinHole.GetPart <acegiak_Fishable>().fromCell.AddObject(fishinHole.GetPart <acegiak_Fishable>().Epic);
                                fishinHole.GetPart <acegiak_Fishable>().fromCell = null;
                                fishinHole.GetPart <acegiak_Fishable>().Epic     = null;
                                fishinHole = null;
                            }
                        }
                    }
                }
            }
            //Debug.Log("End event: "+E.ID+".");

            return(base.FireEvent(E));
        }