コード例 #1
0
ファイル: ChanceToMutate.cs プロジェクト: acegiak/qudders
        public void domutate()
        {
            if (ParentObject.IsPlayer() || ParentObject.IsMemberOfFaction("Templar"))
            {
                return;
            }
            int roll = Stat.Random(1, 100);

            Log("Titroll:" + roll.ToString() + "/" + Chance.ToString());
            if (roll <= Chance)
            {
                Mutations mutations = ParentObject.GetPart("Mutations") as Mutations;
                if (mutations == null)
                {
                    Log("Can mutate, no mutations part");
                    return;
                }
                if (!MutationFactory.MutationsByName.ContainsKey(Mutation))
                {
                    Log("Mutation " + Mutation + " isn't recognised");
                }
                mutations.AddMutation(MutationFactory.MutationsByName[Mutation].CreateInstance(), Level);
                Log("mutated");
            }
        }
コード例 #2
0
        public override bool Mutate(GameObject GO, int Level)
        {
            Body SourceBody = GO.GetPart <Body>();

            if (SourceBody != null)
            {
                GameObject TailObj = GameObject.create("Ovipositor");

                var body = GO.GetPart <Body>();
                var core = body.GetBody();
                var tail = core.AddPartAt(Base: "Tail", DefaultBehavior: "Ovipositor", InsertAfter: "Feet", OrInsertBefore: "Hands");
                tail.DefaultBehaviorBlueprint = "Ovipositor";
                tail.DefaultBehavior          = TailObj;
                // Armor part = TailObj.GetPart<Armor>();
                // part.AV = 1;
                // part.DV = 0;
                body.UpdateBodyParts();
            }
            CooldownMyActivatedAbility(ActivatedAbilityID, PlaceHolder, ParentObject);
            ActivatedAbilities activatedAbilities = ParentObject.GetPart("ActivatedAbilities") as ActivatedAbilities;

            ActivatedAbilityID = activatedAbilities.AddAbility("Lay Egg", "CommandLayEgg", "Physical Mutation", "Lay an egg.", "O", null, false, false, false, false, false, false, false, true, PlaceHolder);
            ChangeLevel(Level);
            return(base.Mutate(GO, Level));
        }
コード例 #3
0
        public void AddPsionicArms()
        {
            Body SourceBody = ParentObject.GetPart("Body") as Body;

            if (SourceBody != null)
            {
                BodyPart ReadyBody          = SourceBody.GetBody();
                BodyPart AttatchArmTemplate = ReadyBody.AddPartAt("Psionic-Arm", 2, null, null, null, null, ManagerID + ArmCounterStrings(), 17, null, null, null, null, null, null, null, null, null, null, null, "Arm", new string[4]
                {
                    "Hands",
                    "Feet",
                    "Roots",
                    "Thrown Weapon"
                });
                AttatchArmTemplate.AddPart("Psionic-Hand", 2, null, "Psionic-Hands", null, null, ManagerID + ArmCounterStrings(), 17);
                ReadyBody.AddPartAt(AttatchArmTemplate, "Psionic-Arm", 1, null, null, null, null, ManagerID + ArmCounterStrings(), 17).AddPart("Psionic-Hand", 1, null, "Psionic-Hands", null, null, ManagerID + ArmCounterStrings(), 17);
                ReadyBody.AddPartAt("Psionic-Hands", 0, null, null, "Psionic-Hands", null, ManagerID + ArmCounterStrings(), 17, null, null, null, null, null, null, null, null, null, null, null, "Hands", new string[3]
                {
                    "Feet",
                    "Roots",
                    "Thrown Weapon"
                });
                ReadyBody.AddPartAt("Missile Weapon", Laterality.RIGHT, null, null, "Psionic-Hands", null, ManagerID + ArmCounterStrings(), Category: 17, null, null, null, null, null, null, null, null, null, null, null, "Hands", new string[1]
                {
                    "Missile Weapon"
                });
                ReadyBody.AddPartAt("Missile Weapon", Laterality.LEFT, null, null, "Psionic-Hands", null, ManagerID + ArmCounterStrings(), Category: 17, null, null, null, null, null, null, null, null, null, null, null, "Hands", new string[1]
                {
                    "Missile Weapon"
                });
            }
        }
コード例 #4
0
 public override bool FireEvent(Event E)
 {
     if (E.ID == "EndTurn")
     {
         Cell currentCell = ParentObject.CurrentCell;
         if (currentCell != null)
         {
             foreach (GameObject item in currentCell.GetObjectsWithPart("Physics"))
             {
                 if (item != ParentObject && item != ParentObject.GetPart <Gas>().Creator&& item.PhaseMatches(ParentObject))
                 {
                     ApplySpores(item);
                 }
             }
         }
     }
     else if (E.ID == "ObjectEnteredCell")
     {
         GameObject gameObjectParameter = E.GetGameObjectParameter("Object");
         if (gameObjectParameter != ParentObject && gameObjectParameter != ParentObject.GetPart <Gas>().Creator&& gameObjectParameter.PhaseMatches(ParentObject))
         {
             ApplySpores(gameObjectParameter);
         }
     }
     return(base.FireEvent(E));
 }
コード例 #5
0
        public override bool FireEvent(Event E)
        {
            if (E.ID == "AttackerQueryWeaponSecondaryAttackChanceMultiplier")
            {
                Body body = ParentObject.GetPart("Body") as Body;

                var ParentsAgility = ParentObject.StatMod("Agility");
                var ParentsLevel   = ParentObject.Statistics["Level"].BaseValue;

                List <BodyPart> hands = body.GetPart("Hand");

                foreach (BodyPart hand in hands)
                {
                    try
                    {
                        if (!hand.Name.Contains("Robo-") && hand.DefaultBehavior != null && hand.DefaultBehavior.HasPart("MartialConditioningFistMod"))
                        {
                            BodyPart bodyPart = E.GetParameter("BodyPart") as BodyPart;
                            if (bodyPart == null || bodyPart.Category != 6)
                            {
                                E.SetParameter("Chance", E.GetIntParameter("Chance") + (1 + ParentsAgility) + (1 * (ParentsLevel / 4)));
                            }
                        }
                    }
                    catch
                    {
                    }
                }
            }

            return(base.FireEvent(E));
        }
コード例 #6
0
ファイル: Seed.cs プロジェクト: Maddremor/QudStarappleValley
        public void Plant(GameObject who)
        {
            Cell cell = ParentObject.CurrentCell;

            if (cell == null)
            {
                Popup.Show("Put things on the ground to plant them.");
                return;
            }
            if (ParentObject.GetPart <Stacker>() != null && ParentObject.GetPart <Stacker>().StackCount > 1)
            {
                GameObject gameObject = ParentObject.DeepCopy(true);
                gameObject.GetPart <Stacker>().StackCount   = ParentObject.GetPart <Stacker>().StackCount - 1;
                ParentObject.GetPart <Stacker>().StackCount = 1;
                who.GetPart <Inventory>().AddObject(gameObject);
                IPart.AddPlayerMessage("You plant one " + ParentObject.DisplayNameOnly + " and collect the rest");
            }

            ParentObject.pPhysics.Takeable = false;
            this.stage = 1;
            //ParentObject.pPhysics.Category = "Plant";
            //ParentObject.RemovePart<NoEffects>();
            tileupdate();
            // Statistic statistic = new Statistic("Energy", 0, 10000, 0, ParentObject);
            // statistic.Owner = ParentObject;
            // ParentObject.Statistics.Add("Energy", statistic);

            // XRLCore.Core.Game.ActionManager.AddActiveObject(ParentObject);
        }
        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));
        }
コード例 #8
0
        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
            {
            }
        }
コード例 #10
0
        public override bool FireEvent(Event E)
        {
            IPart.AddPlayerMessage(E.ID);
            if (E.ID == "GetInventoryActions" && writing == null)
            {
                E.GetParameter <EventParameterGetInventoryActions>("Actions").AddAction("OpheliadWrite", 'W', false, "&WW&yrite", "InvCommandOpheliadWrite", 10);
            }
            if (E.ID == "InvCommandOpheliadWrite" && writing == null)
            {
                //Popup.Show("WHAT");
                // IPart.AddPlayerMessage("Write a memory");
                this.writing             = Popup.AskString("What do you write?", "A memory of the dead", 999);
                ParentObject.DisplayName = "rusty opheliad";
                ParentObject.GetPart <Description>().Short      = "A stained satin cone, its petals marked with some old sorrow.";
                ParentObject.pRender.ColorString                = "&g";
                ParentObject.pRender.DetailColor                = "w";
                ParentObject.GetPart <PreservableItem>().Result = "Brown Dye Phial";

                // IPart.AddPlayerMessage("done");
            }
            if (E.ID == "GetShortDescription")
            {
                if (writing != null)
                {
                    string arg = "&wWritten on its petals: " + this.writing + ".";
                    E.SetParameter("Postfix", E.GetStringParameter("Postfix") + '\n' + arg);
                    DegradeWriting();
                }
            }
            return(base.FireEvent(E));
        }
コード例 #11
0
        public bool HandleEvent(BrewingStartedEvent e)
        {
            var inventory = ParentObject.GetPart <Inventory>();

            if (e.Recipe.Ingredients == null)
            {
                inventory.GetObjects().GetRandomElement(RandomSource).Destroy();
            }
            else
            {
                foreach (var ingredientBlueprint in e.Recipe.Ingredients)
                {
                    inventory
                    .FindObjectByBlueprint(ingredientBlueprint)
                    .Destroy();
                }
            }

            AddPlayerMessage(VariableReplace(
                                 MESSAGE_BREWING_BEGIN,
                                 Subject: ParentObject
                                 ));

            return(true);
        }
 public override bool FireEvent(Event E)
 {
     if (E.ID == "CanSmartUse")
     {
         if ((!E.GetGameObjectParameter("User").IsPlayer() || !ParentObject.IsPlayerLed()))
         {
             return(false);
         }
     }
     else if (E.ID == "CanHaveSmartUseConversation")
     {
         return(false);
     }
     else if (E.ID == "CommandSmartUse")
     {
         GameObject gameObjectParameter = E.GetGameObjectParameter("User");
         if (!gameObjectParameter.IsPlayer() || !ParentObject.IsPlayerLed())
         {
             Drink(gameObjectParameter);
         }
     }
     else if (
         (E.ID == "InvCommandPourObject" || E.ID == "InvCommandDrinkObject" || E.ID == "InvCommandCollectObject") &&
         !GrantsWater(E.GetGameObjectParameter("Owner"))
         )
     {
         return(false);
     }
     else if (E.ID == "InvCommandDrinkObject" && !GrantsWater(E.GetGameObjectParameter("Owner")))
     {
         return(false);
     }
     else if (E.ID == "InvCommandFillFrom")
     {
         Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&y's cap " + ParentObject.GetVerb("elude") + " your grasp.");
         return(false);
     }
     else if (E.ID == "GetShortDescription")
     {
         int Rep = GetFactionReputationFeeling(IPart.ThePlayer);
         if (LastRepOptimization != Rep)
         {
             Description Desc = ParentObject.GetPart <Description>();
             if (GrantsWater(IPart.ThePlayer, DoPopup: false))
             {
                 Desc.Short = FriendlyDescription;
                 E.SetParameter("ShortDescription", FriendlyDescription);
             }
             else
             {
                 Desc.Short = UnfriendlyDescription;
                 E.SetParameter("ShortDescription", UnfriendlyDescription);
             }
             LastRepOptimization = Rep;
         }
     }
     return(base.FireEvent(E));
 }
コード例 #13
0
        public GameObject CheckGlands()
        {
            GameObject result = null;
            int        num    = 0;
            Body       part   = ParentObject.GetPart <Body>();
            BodyPart   bp     = part.GetFirstPart("Glands");

            return(bp.Equipped);
        }
コード例 #14
0
 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));
 }
コード例 #15
0
        public override bool HandleEvent(ObjectCreatedEvent E)
        {
            ParentObject.AddPart <Blackout>();
            Blackout BlackOutHook = ParentObject.GetPart <Blackout>();

            BlackOutHook.Radius = 0;

            return(base.HandleEvent(E));
        }
コード例 #16
0
        public void ApplyElectricShroud()
        {
            try
            { // AddPlayerMessage("MethodFiring: ChangeTargetResistances");
                FocusPsi PsiMutation = ParentObject.GetPart <FocusPsi>();

                var ParentsEgo     = ParentObject.Statistics["Ego"].Modifier;
                var ParentsLevel   = ParentObject.Statistics["Level"].BaseValue;
                var ParentsCharges = ParentObject.Statistics["PsiCharges"].BaseValue;

                string ChargesSpent = PsiMutation.focusPsiCurrentCharges.ToString();

                // AddPlayerMessage("MethodStep: Getting Target");

                Cell       TargetCell = PickDestinationCell(12 + Level, AllowVis.OnlyVisible, false, true, false, true);
                GameObject Target     = TargetCell.GetFirstObjectWithPart("Combat");

                // AddPlayerMessage("MethodStep: Applying Effect");

                if (!Target.HasEffect("ShimmeringShroud"))
                {
                    Owner = ParentObject;
                    Target.ApplyEffect(new ShimmeringShroud(0, Owner: ParentObject));
                    ElectricChargePulse(TargetCell, ParentsCharges);
                    Target.ParticleText("&W\u000f", 0.02f, 10);
                    PlayWorldSound("Electroblast" + (Stat.Random(1, 4)));
                    Event cE = Event.New("SetShimmeringShroudEffectEvent", "MaximumCharges", ParentsCharges, "Potency", Potency, "Caster", ParentObject, "MutationLevel", Level);

                    // AddPlayerMessage("MethodStep: FireEvent CE");

                    Target.FireEvent(cE);
                }
                else
                {
                    Owner = ParentObject;
                    ElectricChargePulse(TargetCell, ParentsCharges);
                    Target.ParticleText("&W\u000f", 0.02f, 10);
                    PlayWorldSound("Electroblast" + (Stat.Random(1, 4)));
                    Event cE = Event.New("AlteringTemperatureEffectEvent", "ChargesSpent", ParentsCharges, "Potency", Potency, "Caster", ParentObject, "MutationLevel", Level);

                    // AddPlayerMessage("MethodStep: FireEvent CE/ No effect");

                    Target.FireEvent(cE);
                }

                // AddPlayerMessage("MethodStep: Setting Flavour Text");


                XDidYToZ(Target, "dawn", null, Target, "shimmering shroud", "!", null, Target, PossessiveObject: true);
                CooldownMyActivatedAbility(ActivateShimmeringShroudAbilityID, ParentsCharges * 3);
            }
            catch
            {
            }
        }
コード例 #17
0
 public override bool FireEvent(Event E)
 {
     if (E.ID == "EnterCell")
     {
         if (ParentObject.GetPart <Chat>() != null)
         {
             ParentObject.GetPart <Chat>().Says = Popup.AskString("Write on sign...", "", 140);
         }
     }
     return(base.FireEvent(E));
 }
コード例 #18
0
 public int PermutationDamagGFA()
 {
     try
     {
         int GFAcidExtraDamage = ParentObject.GetPart <GelatinousFormPoison>().Level + Rules.Stat.Roll("1d6");
         return(GFAcidExtraDamage);
     }
     catch
     {
         return(0);
     }
 }
コード例 #19
0
 public int PermutationDamageQuills()
 {
     try
     {
         int QuillExtraDamage = ParentObject.GetPart <Quills>().Level + Rules.Stat.Roll("1d4");
         return(QuillExtraDamage);
     }
     catch
     {
         return(0);
     }
 }
コード例 #20
0
ファイル: RomancablePart.cs プロジェクト: acegiak/qudkissing
        /*public string storyoptions(string key,string alt){
         *      List<string> output = new List<string>();
         *      foreach(acegiak_RomancePreference preferece in preferences){
         *              string newstring = preferece.getstoryoption(key);
         *              if(newstring != null){
         *                      output.Add(newstring);
         *              }
         *      }
         *      if(output.Count > 0){
         *              return output[Stat.Rnd2.Next(output.Count)];
         *      }
         *      return alt;
         * }*/

        public void AssessDate(GameObject Date, GameObject DateObject)
        {
            havePreference();
            float  value  = (Stat.Rnd2.Next(1, 4) - 2);
            string output = ParentObject.The + ParentObject.ShortDisplayName + " joins you at " + DateObject.the + DateObject.ShortDisplayName;


            foreach (acegiak_RomancePreference preferece in preferences)
            {
                acegiak_RomancePreferenceResult result = preferece.DateAssess(Date, DateObject);

                if (result != null)
                {
                    value  += result.amount;
                    output += "\n" + result.explanation;
                    //IPart.AddPlayerMessage("" + ParentObject.the + ParentObject.DisplayNameOnly + "&Y "+result.explanation);
                }
            }

            if (DateObject.GetPart <Bed>() != null)
            {
                if (ParentObject.GetPart <acegiak_Kissable>() != null)
                {
                    float attractionAmount = ParentObject.GetPart <acegiak_Kissable>().attractionAmount(Date);
                    value += attractionAmount;
                    if (attractionAmount > 0)
                    {
                        output += "\nYou sleep with " + ParentObject.The + ParentObject.ShortDisplayName + ".";
                        ParentObject.ApplyEffect(new Asleep(100));
                        Date.ApplyEffect(new Asleep(100));
                    }
                    if (attractionAmount < 0)
                    {
                        output += "\n" + ParentObject.The + ParentObject.ShortDisplayName + " isn't attracted to you.";
                    }
                }
            }


            Popup.Show(output);
            ParentObject.pBrain.AdjustFeeling(Date, (int)(value * 10));
            Date.GetPart <acegiak_Romancable>().date = null;
            if (value < 1)
            {
                this.patience -= 2;
            }
            else
            {
                this.patience -= 1;
            }
            JournalAPI.AddAccomplishment("&y You took " + ParentObject.a + ParentObject.DisplayNameOnlyDirect + " on a date to " + DateObject.the + DateObject.DisplayNameOnlyDirect + " and " + ParentObject.it + (value > 0?" was&G":" was &rnot") + " impressed&y.", "general", null);
        }
コード例 #21
0
        public override bool ChangeLevel(int NewLevel)
        {
            var body = ParentObject.GetPart <Body>();
            var core = body.GetBody();
            var tail = ParentObject.GetBodyPartByManager(AdditionsManagerID);

            GameObject ThickTailOBJ = GameObject.create("BaseThickTail");
            Armor      armor        = ThickTailOBJ.GetPart("Armor") as Armor;

            armor.WornOn = tail.Type;
            tail.Equip(ThickTailOBJ, true);
            return(base.ChangeLevel(NewLevel));
        }
コード例 #22
0
ファイル: Rider.cs プロジェクト: acegiak/qudrides
        public void AddBodyPart()
        {
            //BodyPartType.Make("Riding", null, "riding", null, null, null, null, null, null, null, null, null, false, true);

            Body part = ParentObject.GetPart <Body>();

            if (part != null)
            {
                BodyPart body = part.GetBody();

                BodyPart bodyPart = body.AddPart("Riding");
            }
        }
コード例 #23
0
 public override bool HandleEvent(GetDisplayNameEvent E)
 {
     if (ParentObject.GetPart <Inventory>() != null && ParentObject.GetPart <Inventory>().Objects.Count() > 0)
     {
         int count = 0;
         foreach (GameObject GO in ParentObject.GetPart <Inventory>().GetObjects())
         {
             count += GO.Count;
         }
         E.AddClause(" &y[" + count + " items]");
     }
     return(true);
 }
コード例 #24
0
        public override void Attach()
        {
            var desiredFaction = Factions.GetRandomFaction();

            var reviledFaction =
                75.in100()      ? Factions.get("Fish")
                /* otherwise */ : Factions.GetRandomFaction();

            ParentObject.AddPart(new AddsRep(desiredFaction.Name, 100));
            ParentObject.AddPart(new AddsRep(reviledFaction.Name, -100));

            ParentObject.GetPart <Description>().Short = $"A legend boldly proclaims the allegiances of the wearer of this strange piece of billed fabric for all to see:\n\nI am desired by {desiredFaction.getFormattedName()}\nAnd reviled by {reviledFaction.getFormattedName()}";
        }
コード例 #25
0
 public override bool FireEvent(Event E)
 {
     if (E.ID == "ObjectExtracted")
     {
         var source = E.GetGameObjectParameter("Source");
         var color  = source.Property["color"];
         ParentObject.GetPart <LimberFungalGasGrenade>().Color = color;
         var preservable = ParentObject.RequirePart <PreservableItem>();
         preservable.Result = "LimberPreserved" + char.ToUpper(color[0]) + color.Substring(1) + "puff";
         preservable.Number = 8;
         return(true);
     }
     return(base.FireEvent(E));
 }
コード例 #26
0
 public override bool HandleEvent(GetDisplayNameEvent E)
 {
     if (ParentObject.Understood())
     {
         if (XRLCore.Core.Game != null && XRLCore.Core.Game.ZoneManager != null && (NameCache == null || XRLCore.Core.Game.ZoneManager.NameUpdateTick > NameCacheTick))
         {
             Teleporter part = ParentObject.GetPart <Teleporter>();
             if (part != null)
             {
                 string destinationZone = part.DestinationZone;
                 if (!string.IsNullOrEmpty(destinationZone))
                 {
                     string text = XRLCore.Core.Game.ZoneManager.GetZoneReferenceDisplayName(destinationZone);
                     if (!string.IsNullOrEmpty(text))
                     {
                         text += " ";
                     }
                     NameCache = text;
                 }
             }
             NameCacheTick = XRLCore.Core.Game.ZoneManager.NameUpdateTick;
         }
         if (!string.IsNullOrEmpty(NameCache))
         {
             string text2 = E.DB.PrimaryBase;
             int    num   = 10;
             if (text2 == null)
             {
                 text2 = "emergency recoiler";
             }
             else
             {
                 num = E.DB[text2];
                 E.DB.Remove(text2);
             }
             StringBuilder stringBuilder = Event.NewStringBuilder();
             stringBuilder.Append(NameCache);
             if (text2.StartsWith("random-point "))
             {
                 stringBuilder.Append(text2.Substring(13));
             }
             else
             {
                 stringBuilder.Append(text2);
             }
             E.AddBase(stringBuilder.ToString(), num - 10);
         }
     }
     return(true);
 }
コード例 #27
0
        public bool Gift(GameObject who, bool FromDialog)
        {
            havePreference();


            Inventory part2 = XRLCore.Core.Game.Player.Body.GetPart <Inventory>();
            List <XRL.World.GameObject> ObjectChoices = new List <XRL.World.GameObject>();
            List <string> ChoiceList = new List <string>();
            List <char>   HotkeyList = new List <char>();
            char          ch         = 'a';

            part2.ForeachObject(delegate(XRL.World.GameObject GO)
            {
                ObjectChoices.Add(GO);
                HotkeyList.Add(ch);
                ChoiceList.Add(GO.DisplayName);
                ch = (char)(ch + 1);
            });
            if (ObjectChoices.Count == 0)
            {
                Popup.Show("You have no gifts to give.");
                return(false);
            }
            int num12 = Popup.ShowOptionList(string.Empty, ChoiceList.ToArray(), HotkeyList.ToArray(), 0, "Select a gift to give.", 60, bRespectOptionNewlines: false, bAllowEscape: true);

            if (num12 < 0)
            {
                return(false);
            }
            int result = (int)((assessGift(ObjectChoices[num12], who).amount + (Stat.Rnd2.Next(1, 4) - 1.5f)) * 10);


            XRL.World.Event event2 = XRL.World.Event.New("SplitStack", "Number", 1);
            event2.AddParameter("OwningObject", XRLCore.Core.Game.Player.Body);
            ObjectChoices[num12].FireEvent(event2);
            if (!part2.FireEvent(XRL.World.Event.New("CommandRemoveObject", "Object", ObjectChoices[num12])))
            {
                Popup.Show("You can't give that object.");
                return(false);
            }
            ObjectChoices[num12].SetStringProperty("GiftedTo", ParentObject.id);
            ParentObject.GetPart <Inventory>().AddObject(ObjectChoices[num12]);
            ParentObject.pBrain.AdjustFeeling(who, result);
            if (who.IsPlayer())
            {
                Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + (result > 0?"&Y likes the " + ObjectChoices[num12].pRender.DisplayName + ".":"&r is unimpressed by the " + ObjectChoices[num12].pRender.DisplayName + "."));
            }
            return(true);
        }
コード例 #28
0
		public GameObject GetPrimaryPolearm()
        {
            GameObject result = null;
			int num = 0;
			Body part = ParentObject.GetPart<Body>();
			List<BodyPart> equippedParts = part.GetEquippedParts();
			foreach (BodyPart item in equippedParts)
			{
				XRL.World.Parts.acegiak_Reach part2 = item.Equipped.GetPart<XRL.World.Parts.acegiak_Reach>();
				if (part2 != null)
				{
					result = item.Equipped;
				}
			}
			return result;        }
コード例 #29
0
        public override bool HandleEvent(InventoryActionEvent e)
        {
            if (e.Command == "Apply" && e.Actor.CheckFrozen())
            {
                GameObject target = e.Actor;
                if (e.Actor.IsPlayer())
                {
                    Cell cell = PickDirection(POV: e.Actor);
                    target = cell.GetCombatTarget(e.Actor);
                    if (target == null)
                    {
                        // cancelled out
                        return(true);
                    }
                }

                if (!target.IsPlayerControlled())
                {
                    if (e.Actor.IsPlayer())
                    {
                        Popup.Show(target.The + target.ShortDisplayName + " refuses your ministrations!");
                    }
                    return(true);
                }

                BodyPart part = Utility.ChooseBodyPart(target, "Apply " + ParentObject.DisplayNameOnly + " to",
                                                       FungalSporeInfection.BodyPartSuitableForFungalInfection);
                if (part == null)
                {
                    // cancelled out
                    return(true);
                }

                var Infection = Utility.GetFungalInfectionFromColor(ParentObject.GetPart <LimberFungalGasGrenade>().Color);
                _ = FungalSporeInfection.ApplyFungalInfection(target, Infection, part);

                if (e.Actor.IsPlayer() && !target.IsPlayer())
                {
                    // ApplyFungalInfection didn't popup, so we need to
                    var blueprint = GameObjectFactory.Factory.Blueprints[Infection];
                    target.pPhysics.PlayWorldSound("FungalInfectionAcquired");
                    Popup.Show(target.The + target.ShortDisplayName + " has contracted " + blueprint.DisplayName() + "&y on " + target.its + " " + part.GetOrdinalName() + ".");
                }

                _ = ParentObject.Destroy();
            }
            return(true);
        }
コード例 #30
0
        public bool HandleEvent(BrewingFinishedEvent e)
        {
            var liquidVolume = ParentObject.GetPart <LiquidVolume>();

            string beverage = null;

            if (LiquidVolume.isValidLiquid(e.Recipe.Beverage))
            {
                beverage = e.Recipe.Beverage;
            }
            else if (PopulationManager.HasPopulation(e.Recipe.Beverage))
            {
                beverage =
                    PopulationManager.RollOneFrom(e.Recipe.Beverage).Blueprint;
            }

            if (beverage != null && LiquidVolume.isValidLiquid(beverage))
            {
                liquidVolume.MixWith(new LiquidVolume(beverage, 1));

                var message = e.Recipe.Mistake ? MESSAGE_BREWING_FAILURE
                             : e.Recipe.Tricky ? MESSAGE_BREWING_SUCCESS_TRICKY
                                               : MESSAGE_BREWING_SUCCESS;

                AddPlayerMessage(VariableReplace(
                                     message.Replace(
                                         "=liquid=",
                                         liquidVolume.GetLiquidName()
                                         ),

                                     Subject: ParentObject
                                     ));

                if (e.Recipe.Mistake)
                {
                    GetAnnoyed(e.Activator);
                }
            }
            else
            {
                AddPlayerMessage(VariableReplace(
                                     MESSAGE_BREWING_HUH,
                                     Subject: ParentObject
                                     ));
            }

            return(true);
        }