Exemplo n.º 1
0
 public override bool FireEvent(Event E)
 {
     if (E.ID == "EndTurnEngulfing")
     {
         if (descriptionSet == false)
         {
             IPart.ThePlayer.GetPart <Description>().Short = "I'm not a bad slime";
             descriptionSet = true;
         }
         GameObject parameter = E.GetParameter <GameObject>("Object");
         if (parameter != null)
         {
             Damage damage = new Damage(Stat.Random(IPart.ThePlayer.Statistics["Toughness"].BaseValue / 2, IPart.ThePlayer.Statistics["Toughness"].BaseValue));
             Event  E1     = Event.New("TakeDamage", 0, 0, 0);
             E1.AddParameter("Damage", (object)damage);
             E1.AddParameter("Owner", (object)this.ParentObject);
             E1.AddParameter("Attacker", (object)this.ParentObject);
             E1.AddParameter("Message", this.DamageMessage);
             parameter.FireEvent(E1);
             if (parameter.hitpoints <= 0)
             {
                 if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&wAverage")
                 {
                     this.statGains(1);
                 }
                 else if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&WTough")
                 {
                     this.statGains(2);
                 }
                 else if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&rVery Tough")
                 {
                     this.statGains(4);
                 }
                 else if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&RImpossible")
                 {
                     this.statGains(8);
                 }
                 Mutations targetMutations = parameter.GetPart <Mutations>();
                 Mutations playerMutations = IPart.ThePlayer.GetPart <Mutations>();
                 if (targetMutations != null)
                 {
                     foreach (BaseMutation mutation in targetMutations.MutationList)
                     {
                         if (!playerMutations.HasMutation(mutation) && !excludedMutations.Contains(mutation.Name) && mutation.CompatibleWith(IPart.ThePlayer))
                         {
                             playerMutations.AddMutation(mutation, 1);
                         }
                     }
                 }
                 Stomach part = IPart.ThePlayer.GetPart <Stomach>();
                 IPart.ThePlayer.RemoveEffect("Famished", false);
                 part.HungerLevel    = 0;
                 part.CookCount      = 0;
                 part.CookingCounter = 0;
                 part.Water          = 30000;
             }
         }
     }
     return(true);
 }
Exemplo n.º 2
0
        public override bool BoonReady(GameObject player)
        {
            int?difference = DifficultyEvaluation.GetDifficultyRating(Romancable.ParentObject, player);

            if (difference == null)
            {
                difference = 0;
            }
            return(this.Romancable.ParentObject.pBrain.GetFeeling(player) > 65 + difference);
        }
 public override bool FireEvent(Event E)
 {
     if (E.ID == "EndTurnEngulfing")
     {
         if (descriptionSet == false)
         {
             this.ParentObject.GetPart <Description>().Short = "I'm not a bad slime";
             descriptionSet = true;
         }
         GameObject parameter = E.GetParameter <GameObject>("Object");
         if (parameter != null)
         {
             Damage damage = new Damage(Stat.Random(this.ParentObject.Statistics["Toughness"].BaseValue / 4, this.ParentObject.Statistics["Toughness"].BaseValue));
             Event  E1     = Event.New("TakeDamage", 0, 0, 0);
             E1.AddParameter("Damage", (object)damage);
             E1.AddParameter("Owner", (object)this.ParentObject);
             E1.AddParameter("Attacker", (object)this.ParentObject);
             E1.AddParameter("Message", this.DamageMessage);
             parameter.FireEvent(E1);
             if (parameter.hitpoints <= 0)
             {
                 if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&wAverage")
                 {
                     this.statGains(1);
                 }
                 else if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&WTough")
                 {
                     this.statGains(2);
                 }
                 else if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&rVery Tough")
                 {
                     this.statGains(4);
                 }
                 else if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&RImpossible")
                 {
                     this.statGains(8);
                 }
                 Stomach part = this.ParentObject.GetPart <Stomach>();
                 this.ParentObject.RemoveEffect("Famished", false);
                 part.HungerLevel    = 0;
                 part.CookCount      = 0;
                 part.CookingCounter = 0;
                 part.Water          = 30000;
             }
         }
     }
     return(true);
 }
Exemplo n.º 4
0
        public void ChanceToFall(GameObject rider, float chance, GameObject mount)
        {
            if (mount.GetPart <Brain>() != null)
            {
                float feeling = mount.GetPart <Brain>().GetFeeling(rider);
                chance += (feeling * -1) * 0.01f;
                int?difference = DifficultyEvaluation.GetDifficultyRating(mount, rider);
                if (difference == null)
                {
                    difference = 0;
                }
                chance += (difference * 0.01f).GetValueOrDefault(0f);

                if (rider.GetPart <Body>() != null)
                {
                    List <BodyPart> parts        = rider.GetPart <Body>().GetParts();
                    float           limblessfall = 10f;
                    foreach (BodyPart part in parts)
                    {
                        if (part.Type == "Arm" ||
                            part.Type == "Feet" ||
                            part.Type == "Tail")
                        {
                            limblessfall = limblessfall / 10f;
                        }
                    }
                    chance += limblessfall;
                }
            }

            Double roll = Stat.Rnd2.NextDouble() * 100;

            //IPart.AddPlayerMessage("fall?"+roll.ToString()+"/"+chance.ToString());
            if (roll <= chance)
            {
                if (rider.IsPlayer())
                {
                    IPart.AddPlayerMessage("You fall from " + mount.the + mount.DisplayNameOnly);
                }
                Dismount(rider);
                rider.ApplyEffect(new Prone());
            }
        }
Exemplo n.º 5
0
 public override bool FireEvent(Event E)
 {
     if (E.ID == "EndTurnEngulfing")
     {
         if (descriptionSet == false)
         {
             IPart.ThePlayer.GetPart <Description>().Short = "I'm not a bad slime";
             descriptionSet = true;
         }
         GameObject parameter = E.GetParameter <GameObject>("Object");
         if (parameter != null)
         {
             Damage damage = new Damage(Stat.Random(IPart.ThePlayer.Statistics["Toughness"].BaseValue / 2, IPart.ThePlayer.Statistics["Toughness"].BaseValue));
             Event  E1     = Event.New("TakeDamage", 0, 0, 0);
             E1.AddParameter("Damage", (object)damage);
             E1.AddParameter("Owner", (object)this.ParentObject);
             E1.AddParameter("Attacker", (object)this.ParentObject);
             E1.AddParameter("Message", this.DamageMessage);
             parameter.FireEvent(E1);
             if (parameter.hitpoints <= 0)
             {
                 if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&wAverage")
                 {
                     this.statGains(1);
                 }
                 else if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&WTough")
                 {
                     this.statGains(2);
                 }
                 else if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&rVery Tough")
                 {
                     this.statGains(4);
                 }
                 else if (DifficultyEvaluation.GetDifficultyDescription(parameter) == "&RImpossible")
                 {
                     this.statGains(8);
                 }
                 Mutations targetMutations = parameter.GetPart <Mutations>();
                 Mutations playerMutations = IPart.ThePlayer.GetPart <Mutations>();
                 if (targetMutations != null)
                 {
                     bool   CasterIsPlayer = XRLCore.Core.Game.Player.Body == this.ParentObject ? true : false;
                     string PopupText;
                     foreach (BaseMutation mutation in targetMutations.MutationList)
                     {
                         //mutation.GetStat() == "Ego"
                         if (!playerMutations.HasMutation(mutation) && mutation.CompatibleWith(this.ParentObject))
                         {
                             if (mutation.GetMutationEntry().Category.Name == "Mental")
                             {
                                 PopupText = "Integrate Mental mutation with name of " + mutation.Name;
                                 if (CasterIsPlayer || UI.Popup.ShowYesNoCancel(PopupText) == DialogResult.Yes)
                                 {
                                     playerMutations.AddMutation(mutation, 1);
                                 }
                             }
                             else if (CasterIsPlayer && ForbiddenMutations.Contains(mutation.Name))//Forbidden Mutations
                             {
                                 if (mutation.AffectsBodyParts())
                                 {
                                     PopupText = "Integrate Forbidden-" + mutation.GetMutationEntry().Category.Name + " BodyBased mutation with name of " + mutation.Name;
                                 }
                                 else
                                 {
                                     PopupText = "Integrate Forbidden-" + mutation.GetMutationEntry().Category.Name + " mutation with name of " + mutation.Name;
                                 }
                                 if (UI.Popup.ShowYesNoCancel(PopupText) == DialogResult.Yes)
                                 {
                                     playerMutations.AddMutation(mutation, 1);
                                 }
                             }
                         }
                     }
                 }
                 Stomach part = IPart.ThePlayer.GetPart <Stomach>();
                 IPart.ThePlayer.RemoveEffect("Famished", false);
                 part.HungerLevel    = 0;
                 part.CookCount      = 0;
                 part.CookingCounter = 0;
                 part.Water          = 30000;
             }
         }
     }
     return(true);
 }