Example #1
0
        public override bool FireEvent(Event E)
        {
            if (E.ID == "EndTurn")
            {
                if (ParentObject.HasPart("OpeningStory"))
                {
                    return(true);
                }
                if (!ParentObject.HasEffect("Inspired"))
                {
                    if (ParentObject.IsPlayer())
                    {
                        Popup.Show("Your training as a carbide chef has inspired you to invent a meal!");
                    }
                    ParentObject.ApplyEffect(new Inspired(Calendar.turnsPerDay * 2));
                    Recipes--;
                }

                if (Recipes == 0)
                {
                    ParentObject.RemovePart(this);
                }
            }
            return(true);
        }
        public override bool HandleEvent(ModifyAttackingSaveEvent E)
        {
            var Parent   = E.Attacker == ParentObject;
            var Defender = E.Defender;

            if (Parent && ParentObject.HasPart("MartialBody") && ParentObject.HasSkill("WM_MMA_CombinationStrikesII"))
            {
                E.NaturalRoll += (CurrentComboICounter / 2);
                E.Roll        += (CurrentComboICounter / 2);
            }

            return(base.HandleEvent(E));
        }
Example #3
0
        public override bool Mutate(GameObject GO, int Level)
        {
            Mutations GainPSiFocus = GO.GetPart <Mutations>();

            if (!GainPSiFocus.HasMutation("FocusPsi"))
            {
                GainPSiFocus.AddMutation("FocusPsi", 1);
            }
            if (!ParentObject.HasPart("ShimmeringShroudHandler"))
            {
                ParentObject.AddPart <ShimmeringShroudHandler>();
            }
            ActivateShimmeringShroudAbilityID = base.AddMyActivatedAbility("Activate Shroud", "CommandShimmeringShroud", "Mental Mutation", null, "*", null, false, false, false, false, false);
            ChargePotentialAbilityID          = base.AddMyActivatedAbility("Charge Potential", "CommandChargePotencyShroud", "Mental Mutation", null, "*", null, true, false, true, false, false);
            PotencyForChargesAbility          = base.AddMyActivatedAbility("Recharge Battery", "ChargeBatteryEvent", "Electrokinesis", null, "~", null, false, false, true, false, false);
            ElectrokinesisGauge = base.AddMyActivatedAbility("Electrokinesis", "ElectroToggleEvent", "Mutation");

            this.ChangeLevel(Level);
            return(base.Mutate(GO, Level));
        }
Example #4
0
        public override bool FireEvent(Event E)
        {
            if (E.ID == "UpdateFistProperties")
            {
                // AddPlayerMessage("Updating fist?");
                MeleeWeapon FistProperties = this.ParentObject.GetPart("MeleeWeapon") as MeleeWeapon;

                FistProperties.BaseDamage = (string)E.GetParameter("Dice");

                if (!ParentObject.HasPart("KO_On_Finish"))
                {
                    ParentObject.AddPart <KO_On_Finish>();

                    // AddPlayerMessage("Part added to " + ParentObject);
                }

                // AddPlayerMessage(FistProperties.BaseDamage);
            }
            return(base.FireEvent(E));
        }
 public override bool AddSkill(GameObject GO)
 {
     if (!ParentObject.HasPart("KO_On_Finish"))
     {
         // AddPlayerMessage("AddingKOPart from Skill Tree");
         ParentObject.AddPart <KO_On_Finish>();
         // AddPlayerMessage("Part KO added to " + ParentObject);
     }
     if (!ParentObject.HasPart("MartialBody"))
     {
         // AddPlayerMessage("Adding MartialbodPart from Skill Tree");
         ParentObject.AddPart <MartialBody>();
         // AddPlayerMessage("Part MB added to " + ParentObject);
     }
     if (!ParentObject.HasSkill("WM_MMA_MartialConI"))
     {
         ParentObject.AddSkill("WM_MMA_MartialConI");
     }
     return(true);
 }
        public void Check()
        {
            if (ParentObject.HasPart(typeof(Brain)))
            {
                var conversationScript =
                    ParentObject.GetPart <ConversationScript>();

                if (conversationScript == null)
                {
                    ParentObject.AddPart(
                        new ConversationScript(ConversationID)
                        );
                }
                else
                {
                    conversationScript.ConversationID = ConversationID;
                }

                ParentObject.RemovePart(this);
            }
        }
Example #7
0
        public override bool Mutate(GameObject GO, int Level)
        {
            if (!ParentObject.HasPart("NotOriginalEntity"))
            {
                // Statshifter - Setting all stats for starting husk
                StatShifter.SetStatShift(ParentObject, "Ego", 6, true);
                StatShifter.SetStatShift(ParentObject, "Willpower", 6, true);
                StatShifter.SetStatShift(ParentObject, "Intelligence", 6, true);
                StatShifter.SetStatShift(ParentObject, "Strength", -6, true);
                StatShifter.SetStatShift(ParentObject, "Toughness", -6, true);
                StatShifter.SetStatShift(ParentObject, "Agility", -6, true);
            }
            if (!ParentObject.HasEffect <Disintegrating>())
            {
                ParentObject.ApplyEffect(new Disintegrating(9999));
            }

            ActivatedAbilities activatedAbilities = ParentObject.GetPart("ActivatedAbilities") as ActivatedAbilities;

            this.ActivatedAbilityID = activatedAbilities.AddAbility("Soulshunt", "CommandSoulShunt", "Mental Mutation", "Shunt the imprints of your victims' mind from their body, and assume the throne of their vessel.\n\n" + "Target makes a Willpower saving-throw vs your Ego Modifier {{light blue|(+10)}} or be shunted from its body; you assume control of the target's body permanently. Your new husk will wither over time. On a successful soulshunt you gain a 10% chance to increase your ego score by {{light blue|1}}." + "\n\n{{dark gray|Base cooldown: 2400}}", "(O)", null, false, false, false, false, false, false, false, false, -1);
            return(base.Mutate(GO, Level));
        }
Example #8
0
 public override bool FireEvent(Event E)
 {
     if (E.ID == "AIGetOffensiveMutationList")
     {
         int                  intParameter        = E.GetIntParameter("Distance");
         GameObject           gameObjectParameter = E.GetGameObjectParameter("Target");
         List <AICommandList> list = (List <AICommandList>)E.GetParameter("List");
         if (pActivatedAbility != null && !ParentObject.AreHostilesAdjacent() && pActivatedAbility.Cooldown <= 0 && intParameter > 3 && !ParentObject.AreHostilesAdjacent() && intParameter < 6 + ParentObject.GetIntProperty("LungeRangeModifier") && ParentObject.HasLOSTo(gameObjectParameter))
         {
             List <Cell> list2 = PickLine(2, AllowVis.OnlyVisible);
             if (list2 == null)
             {
                 return(true);
             }
             if (list2.Count != 2)
             {
                 return(true);
             }
             for (int i = 0; i < list2.Count; i++)
             {
                 foreach (GameObject item in list2[i].LoopObjectsWithPart("Combat"))
                 {
                     if (ParentObject.HasPart("Brain") && ParentObject.GetPart <Brain>().GetFeeling(item) >= 0)
                     {
                         return(true);
                     }
                 }
             }
             list.Add(new AICommandList("CommandAcegiakPolearmLunge", 1));
         }
         return(true);
     }
     if (E.ID == "CommandAcegiakPolearmLunge")
     {
         if (!IsPrimaryPolearmEquipped())
         {
             if (ParentObject.IsPlayer())
             {
                 Popup.Show("You must have a polearm equipped to Polearm Lunge.");
             }
             return(true);
         }
         if (ParentObject.OnWorldMap())
         {
             if (ParentObject.IsPlayer())
             {
                 Popup.Show("You cannot Lunge on the world map.");
             }
             return(true);
         }
         if (ParentObject.pPhysics != null && ParentObject.pPhysics.IsFrozen())
         {
             Popup.Show("You are frozen solid!");
             return(true);
         }
         List <Cell> list3 = PickLine(2, AllowVis.OnlyVisible, ValidLungeTarget);
         if (list3 == null)
         {
             return(true);
         }
         int num  = 3;
         int num2 = 2;
         if (list3.Count != num)
         {
             if (IsPlayer())
             {
                 Popup.Show("You must Lunge 2 spaces.");
             }
             return(false);
         }
         if (!list3[list3.Count - 1].HasObjectWithPart("Combat"))
         {
             if (IsPlayer())
             {
                 Popup.Show("You must Lunge at a target!");
             }
             return(false);
         }
         Physics pPhysics = ParentObject.pPhysics;
         string  text     = ParentObject.pRender.ColorString + ParentObject.pRender.RenderString;
         if (ParentObject.IsPlayer())
         {
             list3.RemoveAt(0);
         }
         int num3 = 10;
         foreach (Cell item2 in list3)
         {
             List <GameObject> objectsWithPart = item2.GetObjectsWithPart("Combat");
             if (objectsWithPart.Count > 0)
             {
                 if (objectsWithPart[0].IsPlayer())
                 {
                     IPart.AddPlayerMessage("&R" + ParentObject.The + ParentObject.DisplayName + " &R" + ParentObject.GetVerb("lunge", PrependSpace: false) + " you!");
                 }
                 if (ParentObject.DistanceTo(item2) == 2)
                 {
                     ParentObject.FireEvent(Event.New("CommandAttackCell", "Cell", item2, "Properties", "Lunging"));
                 }
                 pActivatedAbility.Cooldown = 0;
                 ParentObject.FireEvent(Event.New("LungedTarget", "Defender", objectsWithPart[0]));
                 objectsWithPart[0].FireEvent(Event.New("WasLunged", "Attacker", ParentObject));
                 return(true);
             }
         }
     }
     return(base.FireEvent(E));
 }
Example #9
0
        public void ChargeVisionAbility()
        {
            Cell currentCell = ParentObject.CurrentCell;

            if (currentCell != null)
            {
                int radius = 7;
                foreach (GameObject item in currentCell.ParentZone.FastSquareSearch(currentCell.X, currentCell.Y, radius, "Combat"))
                {
                    if (ParentObject.DistanceTo(item) <= radius && !item.HasEffect("Electrovoyance") && (ParentObject.HasPart("Robot") ||
                                                                                                         ParentObject.HasPart("BaseRobot") ||
                                                                                                         ParentObject.HasPart("UniversalCharger") ||
                                                                                                         ParentObject.HasPart("ElectricalPowerTransmission")))
                    {
                        item.ApplyEffect(new Electravoyance(base.Level, ParentObject));
                    }
                }
            }
        }
        public override bool FireEvent(Event E)
        {
            if (E.ID == "AIGetOffensiveMutationList")
            {
                if (IsMyActivatedAbilityAIUsable(SureStrikesActivatedAbilityID, ParentObject))
                {
                    E.AddAICommand("CommandSureStrikes");
                }
            }
            else if (E.ID == "CommandSureStrikes")
            {
                // AddPlayerMessage("Firing Sure strike commandsurestrikes");

                AwardSureStrikes = 0;


                var MMAAccess = ParentObject.GetPart <WM_MMA_CombinationStrikesI>();
                var ParentAgi = ParentObject.StatMod("Agility");

                if (ParentObject.HasPart("WM_MMA_PathDawnGlider") && IsPlayer())
                {
                    var MMAComboPathDawnAccess = ParentObject.GetPart <WM_MMA_PathDawnGlider>();
                    PlayersSurestrike();
                    MMAComboPathDawnAccess.BonusSureStrike = 0;
                    UpdateCounter();
                }
                else if (IsPlayer())
                {
                    PlayersSurestrike();
                }


                AwardSureStrikes = ParentAgi;
                var eAttacker = _ParentObject;


                if (AwardSureStrikes <= 0)
                {
                    return(base.FireEvent(E));
                }
                else
                {
                    ChainFuntion();
                    ParentObject.CooldownActivatedAbility(SureStrikesActivatedAbilityID, 80 - (AwardSureStrikes * 10));
                }

                if (IsPlayer())
                {
                    UpdateCounter();
                }
            }
            else if (E.ID == "FailedChainingSureStrikes")
            {
                var MMAAccess = ParentObject.GetPart <WM_MMA_CombinationStrikesI>();
                var eAttacker = _ParentObject;

                if (IsPlayer())
                {
                    UpdateCounter();
                }

                if (Stat.Random(1, 100) <= 20 + MMAAccess.CurrentComboICounter)
                {
                    ChainFuntion();
                    ParentObject.CooldownActivatedAbility(SureStrikesActivatedAbilityID, 80 - (AwardSureStrikes * 10));
                }

                if (IsPlayer())
                {
                    UpdateCounter();
                }
            }
            else if (E.ID == "ChainingSureStrikes")
            {
                // AddPlayerMessage("Chaining strike fires");

                var MMAAccess = ParentObject.GetPart <WM_MMA_CombinationStrikesI>();

                var eDefender = E.GetGameObjectParameter("Defender");
                var eAttacker = E.GetGameObjectParameter("Attacker");

                ChainingSureStrike(eDefender);

                if (Stat.Random(1, 100) <= 20 + (MMAAccess.CurrentComboICounter * 2))
                {
                    ChainFuntion();
                    ParentObject.CooldownActivatedAbility(SureStrikesActivatedAbilityID, 80 - (AwardSureStrikes * 10));
                }

                if (IsPlayer())
                {
                    UpdateCounter();
                }
            }
            else if (E.ID == "EndTurn")
            {
                if (IsPlayer())
                {
                    UpdateCounter();
                }
            }
            return(base.FireEvent(E));
        }
        public override bool FireEvent(Event E)
        {
            if (E.ID == "CommandManifestLimb")
            {
                ArmCost    = (2 + ArmCounter) + (2 * ArmCounter) - 1;
                NewArmCost = ArmCost;
                if (NewArmCost <= focusPsiCurrentMaximumCharges)
                {
                    UpdateCharges();
                    ArmCounter += 1;
                }
                else if (NewArmCost > focusPsiCurrentMaximumCharges)
                {
                    UpdateCharges();
                    return(true);
                }
            }

            if (E.ID == "CommandDismissLimb")
            {
                if (ArmCounter >= 1)
                {
                    ArmCounter -= 1;
                }
                UpdateCharges();
            }

            if (E.ID == "AIGetPassiveMutationList")
            {
                // AddPlayerMessage("Hey prepare, to eat my combustion blast.");
                // AddPlayerMessage($"Currentcharges: {focusPsiCurrentCharges}");
                // AddPlayerMessage($"MaximumPsi: {maximumPsiCharge()}");
                if (focusPsiCurrentCharges < focusPsiCurrentMaximumCharges / 2 && !HandlingCharging())
                {
                    E.AddAICommand("CommandFocusPsi");
                    // AddPlayerMessage($"Currentcharges: {focusPsiCurrentCharges}");
                    AddPlayerMessage("Something is gathering psionic energy ...");
                }
                else if (focusPsiCurrentCharges >= focusPsiCurrentMaximumCharges - 1 && HandlingCharging())
                {
                    E.AddAICommand("CommandFocusPsi");
                    // AddPlayerMessage($"Currentcharges: {focusPsiCurrentCharges}");
                    AddPlayerMessage("Something is gathering psionic energy ...");
                }
            }

            if (E.ID == "CommandFocusPsi")
            {
                if (!base.IsMyActivatedAbilityToggledOn(this.PsiFocusActivatedAbilityID))
                {
                    base.ToggleMyActivatedAbility(this.PsiFocusActivatedAbilityID);
                    string verb1   = "begin to gather";
                    string extra1  = "psionic energy";
                    string TermiP1 = ".";
                    XDidY(ParentObject, verb1, extra1, TermiP1);
                    isCharging = true;
                }
                else
                {
                    base.ToggleMyActivatedAbility(this.PsiFocusActivatedAbilityID);
                    string verb2     = "stop";
                    string extra2    = "gathering psi energy";
                    string termiPun2 = ".";
                    XDidY(ParentObject, verb2, extra2, termiPun2);
                    isCharging = false;
                    UseEnergy(1000);
                }
                UpdateCharges();
                return(false);
            }

            else if (E.ID == "EndTurn")
            {
                Psybrachiomancy BrachMutation     = ParentObject.GetPart <Psybrachiomancy>();
                var             PsiburdeningCatch = ParentObject.GetEffect <Psiburdening>();
                if (base.IsMyActivatedAbilityToggledOn(this.PsiFocusActivatedAbilityID) && (focusPsiCurrentCharges < focusPsiCurrentMaximumCharges))
                {
                    int chanceforpsi = (ParentObject.StatMod("Willpower") * 3) + PsiCounter;
                    if (Stat.Random(1, 100) < chanceforpsi)
                    {
                        focusPsiCurrentCharges++;
                        DidX("charge", "psi energy", ".", ColorAsGoodFor: ParentObject);
                    }
                    else
                    {
                        PsiCounter++;
                    }
                    turnsTilPsiDecay++;
                }
                else if (ParentObject.HasPart("Psybrachiomancy") && BrachMutation.ArmCounter <= Math.Min(1, ParentObject.StatMod("Willpower")) && ParentObject.HasEffect("Psiburdening"))
                {
                    ParentObject.RemoveEffect(PsiburdeningCatch);
                }

                UpdateCharges();
            }

            else if (E.ID == "PsionicDecay")
            {
                if (!(ParentObject.MakeSave("Willpower", effectiveSaveTarget, null, null, "Psionic Decay")))
                {
                    focusPsiCurrentCharges -= E.GetIntParameter("Amount", (int)0); // Current default value is zero, change default value to something more appropriate later
                }

                UpdateCharges();
            }

            else if (E.ID == "FireEventDebuffSystem")
            {
                Psybrachiomancy BrachMutation = ParentObject.GetPart <Psybrachiomancy>();
                if (BrachMutation.ArmCounter > ParentObject.StatMod("Willpower") + BrachMutation.Level / 2 && !ParentObject.HasEffect("Psiburdening"))
                {
                    ParentObject.ApplyEffect(new Psiburdening((Stat.Random(10, 20) - ParentObject.StatMod("Willpower")) * Stat.Random(50, 125)));
                }
                else if (BrachMutation.ArmCounter < ParentObject.StatMod("Willpower") && ParentObject.HasEffect("Psiburdening"))
                {
                    ParentObject.RemoveEffect("Psiburdening");
                }
            }

            return(base.FireEvent(E));
        }
Example #12
0
        public override bool FireEvent(Event E)
        {
            if (E.ID == "ApplyTonic")
            {
                GameObject target = E.GetGameObjectParameter("Target");
                target.PermuteRandomMutationBuys();
                var       Messages  = new List <string>();
                var       gainLimb  = false;
                Mutations mutations = null;
                if (target.IsPlayer())
                {
                    Popup.Show("As the tonic floods your veins, you feel the latent genetic pressure of eons.");
                }
                if (ParentObject.HasPart("Temporary") && !target.HasPart("Temporary"))
                {
                    Messages.Add((target.IsPlayer() ? "Your" :
                                  Grammar.MakePossessive(target.The + target.ShortDisplayName)) +
                                 " genes ache longingly.");
                }
                else
                {
                    var Random    = Utility.Random(this, target);
                    var goodColor = ColorCoding.ConsequentialColor(ColorAsGoodFor: target);
                    var badColor  = ColorCoding.ConsequentialColor(ColorAsBadFor: target);
                    if (target.IsTrueKin())
                    {
                        var which = new[] { "Strength", "Agility", "Toughness" }.GetRandomElement(Random);
                        if (target.HasStat(which))
                        {
                            ++target.Statistics[which].BaseValue;
                            Messages.Add(goodColor +
                                         (target.IsPlayer() ? "You" : target.The + target.ShortDisplayName) +
                                         target.GetVerb("gain") + " 1 point of " + which + "!");
                        }
                    }
                    else   /*if mutant*/
                    {
                        mutations = target.GetPart <Mutations>();
                        if (target.IsEsper())
                        {
                            // can't chimerify; reduce glimmer instead
                            int glimmerReduction = Random.Next(1, 5);
                            int currentGlimmer   = target.GetPsychicGlimmer();
                            if (glimmerReduction > currentGlimmer)
                            {
                                glimmerReduction = currentGlimmer;
                            }
                            _ = target.ModIntProperty("GlimmerModifier", -glimmerReduction);
                            target.SyncMutationLevelAndGlimmer();
                            Messages.Add("Nerves weave and ossify, unable to escape " +
                                         (target.IsPlayer() ? "your" : Grammar.MakePossessive(target.the + target.ShortDisplayName)) +
                                         " psychic cage.");
                        }
                        else if (!target.IsChimera())
                        {
                            var mentals       = target.GetMentalMutations();
                            var mentalDefects = target.GetMutationsOfCategory("MentalDefects");
                            var mpToTransfer  = 0;
                            if (mentals.Count > 0 || mentalDefects.Count > 0)
                            {
                                Messages.Add((target.IsPlayer() ? "Your" :
                                              Grammar.MakePossessive(target.The + target.ShortDisplayName)) +
                                             " genome sloughs off superfluous layers of alien thoughtstuff.");
                                Messages.Add("");
                            }
                            if (mentals.Count > 0)
                            {
                                // choose 1d4 MP of investment in mental mutations to remove...
                                mpToTransfer = Random.Next(1, 5);
                                var totalLevels = mentals.Map(m => m.BaseLevel).Sum();
                                var toReduce    = new List <Tuple <BaseMutation, int> >(mpToTransfer);
                                if (totalLevels <= mpToTransfer)
                                {
                                    // remove everything, will be eligible for Chimera
                                    mpToTransfer = totalLevels;
                                    foreach (var mental in mentals)
                                    {
                                        toReduce.Add(Tuple.Create(mental, mental.BaseLevel));
                                    }
                                }
                                else
                                {
                                    // magically pick mpToTransfer mutations weighted by level
                                    var remainingLevels    = totalLevels;
                                    var remainingReduction = mpToTransfer;
                                    foreach (var mental in mentals)
                                    {
                                        var thisMentalReduction = 0;
                                        while (0 < remainingReduction && Random.Next(0, remainingLevels) < mental.BaseLevel - thisMentalReduction + remainingReduction - 1)
                                        {
                                            ++thisMentalReduction;
                                            --remainingLevels;
                                            --remainingReduction;
                                        }
                                        if (0 < thisMentalReduction)
                                        {
                                            toReduce.Add(Tuple.Create(mental, thisMentalReduction));
                                        }
                                        remainingLevels -= mental.BaseLevel - thisMentalReduction;
                                        if (0 >= remainingReduction)
                                        {
                                            break;
                                        }
                                    }
                                }
                                // ... remove them...
                                var lostMentals = new List <MutationEntry>();
                                foreach (var mental in toReduce)
                                {
                                    var mutation  = mental.Item1;
                                    var reduction = mental.Item2;
                                    if (mutation.BaseLevel <= reduction)
                                    {
                                        // remove the mutation altogether
                                        lostMentals.Add(mutation.GetMutationEntry());
                                        mutations.RemoveMutation(mutation);
                                    }
                                    else
                                    {
                                        // reduce the mutation level
                                        mutations.LevelMutation(mutation, mutation.BaseLevel - reduction);
                                    }
                                }
                                // ... and replace any lost mental mutations with physical mutations
                                foreach (var mental in lostMentals)
                                {
                                    // expensive to regenerate this each time, but won't be very many times and
                                    // want to make sure exclusions from e.g. Stinger are handled correctly
                                    Messages.Add(badColor +
                                                 (target.IsPlayer() ? "You" : target.The + target.ShortDisplayName) +
                                                 target.GetVerb("lose") + " " + mental.DisplayName + "!");
                                    var eligiblePhysicals = mutations.GetMutatePool(m => m.Category.Name.EndsWith("Physical")).Shuffle(Random);
                                    var similarPhysicals  = eligiblePhysicals.Where(p => p.Cost == mental.Cost);
                                    var otherPhysicals    = eligiblePhysicals.Where(p => p.Cost != mental.Cost);
                                    foreach (var physical in similarPhysicals.Concat(otherPhysicals))
                                    {
                                        _ = mutations.AddMutation(physical, 1);
                                        Messages.Add(goodColor +
                                                     (target.IsPlayer() ? "You" : target.The + target.ShortDisplayName) +
                                                     target.GetVerb("gain") + " " + physical.DisplayName + "!");
                                        --mpToTransfer;
                                        break;
                                    } // else if there are no valid physical mutations, don't add anything new
                                }
                            }
                            while (0 < mpToTransfer)
                            {
                                var          physicals        = target.GetPhysicalMutations();
                                BaseMutation which            = null;
                                var          canLevelNormally = physicals.Where(m => m.CanIncreaseLevel());
                                if (canLevelNormally.Any())
                                {
                                    which = canLevelNormally.GetRandomElement(Random);
                                }
                                else
                                {
                                    var underMaxLevel = physicals.Where(m => m.BaseLevel < m.MaxLevel);
                                    if (underMaxLevel.Any())
                                    {
                                        which = underMaxLevel.GetRandomElement(Random);
                                    }
                                }
                                if (which != null)
                                {
                                    mutations.LevelMutation(which, which.BaseLevel + 1);
                                    --mpToTransfer;
                                }
                                else
                                {
                                    // no physical mutations to put the levels in, spend the rest on a new one
                                    foreach (var physical in mutations.GetMutatePool(m => m.Category.Name.EndsWith("Physical")).Shuffle(Random))
                                    {
                                        _ = mutations.AddMutation(physical, 1);
                                        Messages.Add(goodColor +
                                                     (target.IsPlayer() ? "You" : target.The + target.ShortDisplayName) +
                                                     target.GetVerb("gain") + " " + physical.DisplayName + "!");
                                        break;
                                    }
                                    mpToTransfer = 0;
                                }
                            }
                            if (target.GetMentalMutations().Count == 0)
                            {
                                foreach (var mutation in mentalDefects)
                                {
                                    mutations.RemoveMutation(mutation);

                                    var mental = mutation.GetMutationEntry();
                                    Messages.Add(goodColor +
                                                 (target.IsPlayer() ? "You" : target.The + target.ShortDisplayName) +
                                                 target.GetVerb("lose") + " " + mental.DisplayName + "!");

                                    var eligibleDefects = MutationFactory.GetMutationsOfCategory("PhysicalDefects").Shuffle(Random);
                                    var similarDefects  = eligibleDefects.Where(p => p.Cost == mental.Cost);
                                    var otherDefects    = eligibleDefects.Where(p => p.Cost != mental.Cost);
                                    foreach (var physical in similarDefects.Concat(otherDefects))
                                    {
                                        _ = mutations.AddMutation(physical, 1);
                                        Messages.Add(badColor +
                                                     (target.IsPlayer() ? "You" : target.The + target.ShortDisplayName) +
                                                     target.GetVerb("gain") + " " + physical.DisplayName + "!");
                                        break;
                                    } // else if there are no valid physical defects, don't add anything new
                                }

                                target.Property["MutationLevel"] =
                                    target.Property.GetValueOrDefault("MutationLevel", "") + "Chimera";
                                Messages.Add("");
                                Messages.Add(goodColor +
                                             (target.IsPlayer() ? "You" : target.The + target.ShortDisplayName) +
                                             target.GetVerb("become") + " a Chimera!");
                            }
                        }
                        else   /*target.IsChimera*/
                        {
                            // 50% chance of new limb, 50% chance of mutation level gain
                            if (Random.Next(2) == 0)
                            {
                                // new limb! defer until the other messages are shown to actually gain it
                                gainLimb = true;
                            }
                            else
                            {
                                var physicals = target.GetPhysicalMutations().Where(m => m.CanLevel());
                                if (physicals.Any())
                                {
                                    // +1 to level of a physical mutation, uncapped
                                    var          which  = physicals.GetRandomElement(Random);
                                    const string source = "{{r-r-r-R-R-W distribution|limbic fluid}} injections";
                                    var          found  = false;
                                    foreach (var mod in mutations.MutationMods)
                                    {
                                        if (mod.sourceName == source && mod.mutationName == which.Name)
                                        {
                                            ++mod.bonus;
                                            found = true;
                                        }
                                    }
                                    if (!found)
                                    {
                                        _ = mutations.AddMutationMod(which.Name, 1, Mutations.MutationModifierTracker.SourceType.StatMod, source);
                                    }
                                    Messages.Add(goodColor +
                                                 (target.IsPlayer() ? "You" : target.The + target.ShortDisplayName) +
                                                 target.GetVerb("gain") + " one rank of " + which.DisplayName + "!");
                                }
                                else
                                {
                                    // +1 MP if we can't level anything
                                    target.GainMP(1);
                                    Messages.Add(goodColor +
                                                 (target.IsPlayer() ? "You" : target.The + target.ShortDisplayName) +
                                                 target.GetVerb("gain") + " one MP!");
                                }
                            }
                        }
                    }
                }
                if (target.IsPlayer() && Messages.Count > 0)
                {
                    var output = string.Join("\n", Messages);
                    output = _extraLines.Replace(output, "\n\n");
                    Popup.Show(output);
                }
                else
                {
                    foreach (var Message in Messages)
                    {
                        AddPlayerMessage(Message);
                    }
                }
                if (gainLimb)
                {
                    _ = mutations.AddChimericBodyPart();
                }
            }
            return(base.FireEvent(E));
        }
Example #13
0
 public void AddModifiers()
 {
     if (ParentObject.DisplayName.Contains("Playful") ||
         ParentObject.DisplayName.Contains("Energetic") ||
         ParentObject.DisplayName.Contains("Exciting") ||
         ParentObject.DisplayName.Contains("Wild"))
     {
         ParentObject.Statistics["MoveSpeed"].BaseValue += Stat.Random(5, 15);
     }
     else if (ParentObject.DisplayName.Contains("Funny") ||
              ParentObject.DisplayName.Contains("Awkward") ||
              ParentObject.DisplayName.Contains("Clueless") ||
              ParentObject.DisplayName.Contains("Floppy-tongued"))
     {
         Description Desc = ParentObject.GetPart <Description>();
         Desc._Short = Desc._Short + " =pronouns.Subjective= seems very silly.";
     }
     else if (ParentObject.DisplayName.Contains("Clever"))
     {
         if (!ParentObject.HasPart("LegendaryDogsWaterFinder"))
         {
             ParentObject.AddPart <LegendaryDogsWaterFinder>(new LegendaryDogsWaterFinder(), true);
         }
     }
     else if (ParentObject.DisplayName.Contains("Soft"))
     {
         if (!ParentObject.HasPart("LegendaryDogsPetTitlePart"))
         {
             ParentObject.AddPart <LegendaryDogsPetTitlePart>(new LegendaryDogsPetTitlePart(), true);
         }
     }
     else if (ParentObject.DisplayName.Contains("Loyal"))
     {
         // nothing
     }
     else if (ParentObject.DisplayName.Contains("Loveable"))
     {
         // handled via effects
     }
     else if (ParentObject.DisplayName.Contains("Messy"))
     {
         ParentObject.MakeBloody(LegendaryDogsDogBuilder.MessyLiquids.GetRandomElement());
     }
     else if (ParentObject.DisplayName.Contains("Happy"))
     {
         // nothing
     }
     else if (ParentObject.DisplayName.Contains("Simple"))
     {
         // nothing
     }
     else if (ParentObject.DisplayName.Contains("Loving"))
     {
         // nothing
     }
     else if (ParentObject.DisplayName.Contains("Content"))
     {
         // nothing
     }
     else if (ParentObject.DisplayName.Contains("Good"))
     {
         this.GoodFactionPenalty = 100 + 25 * (ParentObject.DisplayName.Split(new[] { "Very" }, StringSplitOptions.None).Length - 1);
     }
     else if (ParentObject.DisplayName.Contains("Caring"))
     {
         // nothing
     }
     else if (ParentObject.DisplayName.Contains("Fluffy"))
     {
         if (!ParentObject.HasPart("LegendaryDogsPetTitlePart"))
         {
             ParentObject.AddPart <LegendaryDogsPetTitlePart>(new LegendaryDogsPetTitlePart("fluffy"), true);
         }
     }
     else if (ParentObject.DisplayName.Contains("Smooth"))
     {
         if (!ParentObject.HasPart("LegendaryDogsPetTitlePart"))
         {
             ParentObject.AddPart <LegendaryDogsPetTitlePart>(new LegendaryDogsPetTitlePart("smooth"), true);
         }
     }
     else if (ParentObject.DisplayName.Contains("Warm"))
     {
         if (!ParentObject.HasPart("LegendaryDogsPetTitlePart"))
         {
             ParentObject.AddPart <LegendaryDogsPetTitlePart>(new LegendaryDogsPetTitlePart("warm"), true);
         }
     }
     else if (ParentObject.DisplayName.Contains("Stub-tailed"))
     {
         // nothing
     }
 }
        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));
        }