Beispiel #1
0
 public override void ObjectEnteredCell(LiquidVolume Liquid, XRL.World.GameObject GO)
 {
     if (Liquid.MaxVolume == -1 && GO.PhaseAndFlightMatches(Liquid.ParentObject) && GO.GetIntProperty("Slimewalking") <= 0 && GO.HasPart("Body"))
     {
         int difficulty = 10 + (int)((double)(Liquid.ComponentLiquids[2] * 5) / 1000.0);
         if (!GO.MakeSave("Strength,Agility", difficulty, null, null, "Furling Agent Restraint"))
         {
             GO.ApplyEffect(new cloneStuck(12, Liquid.ComponentLiquids[2] / 100, null));
         }
     }
 }
Beispiel #2
0
 public override bool PouredOn(LiquidVolume Liquid, XRL.World.GameObject GO)
 {
     // if (Liquid.ComponentLiquids.Count != 1)
     // {
     //  return true;
     // }
     if (Liquid.Volume > 0)
     {
         GO.pRender.TileColor   = "&" + this.Color;
         GO.pRender.ColorString = "&" + this.Color;
         GO.pRender.DetailColor = ToggleCase(this.Color);
     }
     return(true);
 }
        public TileMaker(string blueprintString)
        {
            GameObject go = null;

            if (GameObjectFactory.Factory.Blueprints.ContainsKey(blueprintString))
            {
                go = GameObjectFactory.Factory.CreateObject(blueprintString);
            }
            this.Initialize(go, false);
            if (go != null)
            {
                go.Destroy();
            }
        }
Beispiel #4
0
        public override void ObjectEnteredCell(LiquidVolume Liquid, XRL.World.GameObject GO)
        {
            if (Liquid.MaxVolume != -1 || !GO.HasPart("Body") || !GO.PhaseAndFlightMatches(Liquid.ParentObject) || Liquid.Volume > 1000)
            {
                return;
            }
            int num = 10 + (int)((double)(Liquid.ComponentLiquids[this.ID] * 5) / 1000.0);

            if (!GO.MakeSave("Agility", num, null, null, "Dye"))
            {
                if (GO.IsPlayer())
                {
                    MessageQueue.AddPlayerMessage("&CYou get covered in " + ColorNames[this.Color] + " dye!");
                }
                GO.pRender.TileColor   = "&" + this.Color;
                GO.pRender.ColorString = "&" + this.Color;
                GO.pRender.DetailColor = ToggleCase(this.Color);
            }
        }
Beispiel #5
0
 public static bool Prefix(TradeUI __instance, XRL.World.GameObject Trader)
 {
     Debug.Log("Running Trade Patch to check willingness!");
     if (Trader.HasPart("DynamicPersonality"))
     {
         DynamicPersonality personality = Trader.GetPart <DynamicPersonality>();
         if (personality.WillingToTrade)
         {
             Debug.Log("Is willing to trade!");
             return(true);
         }
         else
         {
             Debug.Log("Is NOT willing to trade!");
             Popup.ShowFail(Trader.The + Trader.ShortDisplayName + " does not like you well enough to trade.");
             return(false);
         }
     }
     else
     {
         Debug.LogError($"CheckTradeWillingnessPatch run on gameobject {Trader.DebugName} which has no DynamicPersonality part");
         return(true);
     }
 }
Beispiel #6
0
 public override bool Drank(LiquidVolume Liquid, int Volume, XRL.World.GameObject Target, StringBuilder Message, ref bool ExitInterface)
 {
     Message.Append("It tastes " + ColorNames[Color] + ".");
     Target.pRender.DetailColor = this.Color;
     return(true);
 }
 public TileMaker(GameObject go)
 {
     this.Initialize(go);
 }
        private void Initialize(GameObject go, bool renderOK = true)
        {
            this.Tile                = string.Empty;
            this.RenderString        = string.Empty;
            this.BackgroundString    = string.Empty;
            this.DetailColorChar     = 'k';
            this.ForegroundColorChar = 'y';
            this.BackgroundColorChar = 'k';
            this.DetailColor         = ConsoleLib.Console.ColorUtility.ColorMap['k'];
            this.ForegroundColor     = ConsoleLib.Console.ColorUtility.ColorMap['y'];
            this.BackgroundColor     = ConsoleLib.Console.ColorUtility.ColorMap['k'];

            //gather render data for GameObject similar to how the game does it in Cell.cs
            Render pRender = go?.pRender;

            if (pRender == null || !pRender.Visible || Globals.RenderMode != RenderModeType.Tiles)
            {
                return;
            }
            RenderEvent renderData   = new RenderEvent();
            Examiner    examinerPart = go.GetPart <Examiner>();

            if (examinerPart != null && !string.IsNullOrEmpty(examinerPart.UnknownTile) && !go.Understood())
            {
                renderData.Tile = examinerPart.UnknownTile;
            }
            else
            {
                renderData.Tile = go.pRender.Tile;
            }
            if (!string.IsNullOrEmpty(pRender.TileColor))
            {
                renderData.ColorString = pRender.TileColor;
            }
            else
            {
                renderData.ColorString = pRender.ColorString;
            }
            if (renderOK) //we can't render blueprint-created objects, because the game will throw errors trying to check their current cell
            {
                go.Render(renderData);
            }

            //renderData.Tile can be null if something has a temporary character replacement, like the up arrow from flying
            this.Tile             = !string.IsNullOrEmpty(renderData.Tile) ? renderData.Tile : pRender.Tile;
            this.RenderString     = !string.IsNullOrEmpty(renderData.RenderString) ? renderData.RenderString : pRender.RenderString;
            this.BackgroundString = renderData.BackgroundString;

            ////DEBUG
            //UnityEngine.Debug.Log("Render data from GameObject.Render() for " + go.DisplayName + ":\n    Tile=" + renderData.Tile
            //    + "\n    ColorString=" + renderData.ColorString
            //    + "\n    DetailColor=" + renderData.DetailColor
            //    + "\n    RenderString=" + renderData.RenderString
            //    + "\n    BackgroundString=" + renderData.BackgroundString
            //    + "\nRender data from object itself:"
            //    + "\n    Tile=" + pRender.Tile
            //    + "\n    RenderString=" + pRender.RenderString
            //    + "\n    TileColor=" + pRender.TileColor
            //    + "\n    ColorString=" + pRender.ColorString
            //    + "\n    DetailColor=" + pRender.DetailColor);
            ////DEBUG

            //save render data in our custom TileColorData format, using logic similar to QudItemListElement.InitFrom()
            if (!string.IsNullOrEmpty(pRender.DetailColor))
            {
                this.DetailColor     = ConsoleLib.Console.ColorUtility.ColorMap[pRender.DetailColor[0]];
                this.DetailColorChar = pRender.DetailColor[0];
            }
            //from what I've been able to determine, I believe that the BackgroundString only applies to non-tiles (RenderString) entities (such as gas clouds)
            string colorString = renderData.ColorString + (string.IsNullOrEmpty(this.Tile) ? this.BackgroundString : string.Empty);

            if (!string.IsNullOrEmpty(colorString))
            {
                for (int j = 0; j < colorString.Length; j++)
                {
                    if (colorString[j] == '&' && j < colorString.Length - 1)
                    {
                        if (colorString[j + 1] == '&')
                        {
                            j++;
                        }
                        else
                        {
                            this.ForegroundColor     = ConsoleLib.Console.ColorUtility.ColorMap[colorString[j + 1]];
                            this.ForegroundColorChar = colorString[j + 1];
                        }
                    }
                    if (colorString[j] == '^' && j < colorString.Length - 1)
                    {
                        if (colorString[j + 1] == '^')
                        {
                            j++;
                        }
                        else
                        {
                            this.BackgroundColor     = ConsoleLib.Console.ColorUtility.ColorMap[colorString[j + 1]];
                            this.BackgroundColorChar = colorString[j + 1];
                        }
                    }
                }
            }
            this.Attributes = ColorUtility.MakeColor(ColorUtility.CharToColorMap[this.ForegroundColorChar], ColorUtility.CharToColorMap[this.BackgroundColorChar]);
        }
        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!"
                            }));
                        }
                    }
                }
            }
        }
Beispiel #10
0
 public override bool Drank(LiquidVolume Liquid, int Volume, XRL.World.GameObject Target, StringBuilder Message, ref bool ExitInterface)
 {
     Message.Append("&WDisgusting!");
     return(true);
 }
        public override void RenderSmearPrimary(LiquidVolume Liquid, RenderEvent eRender, XRL.World.GameObject obj)
        {
            int num = XRLCore.CurrentFrame % 60;

            if (num > 5 && num < 15)
            {
                eRender.ColorString = "&K";
            }
            base.RenderSmearPrimary(Liquid, eRender, obj);
        }