Skip to content

Commit

Permalink
Fix for v2.0.203.56
Browse files Browse the repository at this point in the history
  • Loading branch information
koboldunderlord authored Aug 4, 2022
1 parent 90888be commit c8b917a
Show file tree
Hide file tree
Showing 11 changed files with 350 additions and 291 deletions.
123 changes: 121 additions & 2 deletions LegendaryDogsDogBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
using XRL.Core;
using XRL.Rules;
using XRL.UI;
using XRL.World.Parts.Effects;
using XRL.World.Effects;
using XRL.World.Parts;
using XRL.Messages;

namespace XRL.World
namespace XRL.World.Encounters.EncounterObjectBuilders
{
public class LegendaryDogsDogBuilder
{
Expand Down Expand Up @@ -130,5 +132,122 @@ public static string BuildName(string BaseName, string Title)
}
return NameBuilder.ToString();
}

public static void AddModifiers(GameObject dog)
{
if (dog.DisplayName.Contains("Playful")
|| dog.DisplayName.Contains("Energetic")
|| dog.DisplayName.Contains("Exciting")
|| dog.DisplayName.Contains("Wild"))
{
dog.Statistics["MoveSpeed"].BaseValue += Stat.Random(5, 15);
}
else if (dog.DisplayName.Contains("Funny")
|| dog.DisplayName.Contains("Awkward")
|| dog.DisplayName.Contains("Clueless")
|| dog.DisplayName.Contains("Floppy-tongued"))
{
Description Desc = dog.GetPart<Description>();
Desc._Short = Desc._Short + " =pronouns.Subjective= seems very silly.";

}
else if (dog.DisplayName.Contains("Clever"))
{
if (!dog.HasPart("LegendaryDogsWaterFinder"))
{
dog.AddPart<LegendaryDogsWaterFinder>(new LegendaryDogsWaterFinder(), true);
}
}
else if (dog.DisplayName.Contains("Soft"))
{
if (!dog.HasPart("LegendaryDogsPetTitlePart"))
{
dog.AddPart<LegendaryDogsPetTitlePart>(new LegendaryDogsPetTitlePart(), true);
}
}
else if (dog.DisplayName.Contains("Loyal"))
{
// nothing
}
else if (dog.DisplayName.Contains("Loveable"))
{
// handled via effects
}
else if (dog.DisplayName.Contains("Messy"))
{
dog.MakeBloody(MessyLiquids.GetRandomElement());
}
else if (dog.DisplayName.Contains("Happy"))
{
// nothing
}
else if (dog.DisplayName.Contains("Simple"))
{
// nothing
}
else if (dog.DisplayName.Contains("Loving"))
{
// nothing
}
else if (dog.DisplayName.Contains("Content"))
{
// nothing
}
else if (dog.DisplayName.Contains("Good"))
{
LegendaryDogsDogHero1 heroPart = dog.GetPart<LegendaryDogsDogHero1>();
heroPart.GoodFactionPenalty = 100 + 25 * (dog.DisplayName.Split(new[] { "Very" }, StringSplitOptions.None).Length - 1);
}
else if (dog.DisplayName.Contains("Caring"))
{
// nothing
}
else if (dog.DisplayName.Contains("Fluffy"))
{
if (!dog.HasPart("LegendaryDogsPetTitlePart"))
{
dog.AddPart<LegendaryDogsPetTitlePart>(new LegendaryDogsPetTitlePart("fluffy"), true);
}
}
else if (dog.DisplayName.Contains("Smooth"))
{
if (!dog.HasPart("LegendaryDogsPetTitlePart"))
{
dog.AddPart<LegendaryDogsPetTitlePart>(new LegendaryDogsPetTitlePart("smooth"), true);
}
}
else if (dog.DisplayName.Contains("Warm"))
{
if (!dog.HasPart("LegendaryDogsPetTitlePart"))
{
dog.AddPart<LegendaryDogsPetTitlePart>(new LegendaryDogsPetTitlePart("warm"), true);
}
}
else if (dog.DisplayName.Contains("Stub-tailed"))
{
// nothing
}
}



public bool BuildObject(GameObject dog, string Context = null)
{
string Title = Titles.GetRandomElement();
if (Title == "Good")
{
Title = BuildGoodTitle();
LegendaryDogsDogHero1 heroPart = dog.GetPart<LegendaryDogsDogHero1>();
heroPart.VeryGoodText = Title.ToLower();
}
string name = BuildName(dog.DisplayName, Title);
dog.DisplayName = name;

AddModifiers(dog);

dog.HasProperName = true;

return true;
}
}
}
119 changes: 3 additions & 116 deletions LegendaryDogsDogHero1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using XRL.Core;
using XRL.Rules;
using XRL.UI;
using XRL.World.Parts.Effects;
using XRL.World.Effects;

namespace XRL.World.Parts
{
Expand All @@ -17,7 +17,6 @@ public class LegendaryDogsDogHero1 : IPart

public LegendaryDogsDogHero1()
{
base.Name = "LegendaryDogsDogHero1";
if (this.VeryGoodText == null)
{
this.VeryGoodText = "";
Expand All @@ -31,126 +30,14 @@ public override bool SameAs(IPart p)

public override void Register(GameObject Object)
{
Object.RegisterPartEvent(this, "ObjectCreated");
Object.RegisterPartEvent(this, "BeforeDeathRemoval");
Object.RegisterPartEvent(this, "AfterLookedAt");
}

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
}
base.Register(Object);
}

public override bool FireEvent(Event E)
{
if (E.ID == "ObjectCreated")
{
if (bCreated)
{
return true;
}
bCreated = true;

string Title = LegendaryDogsDogBuilder.Titles.GetRandomElement();
if (Title == "Good")
{
Title = LegendaryDogsDogBuilder.BuildGoodTitle();
VeryGoodText = Title.ToLower();
}
ParentObject.DisplayName = LegendaryDogsDogBuilder.BuildName(ParentObject.DisplayName, Title);
AddModifiers();
}
else if (E.ID == "BeforeDeathRemoval" && this.GoodFactionPenalty > 0)
if (E.ID == "BeforeDeathRemoval" && this.GoodFactionPenalty > 0)
{
GameObject gameObjectParameter = E.GetGameObjectParameter("Killer");
if (gameObjectParameter != null && (gameObjectParameter.IsPlayer() || gameObjectParameter.IsPlayerLed()))
Expand Down
1 change: 0 additions & 1 deletion LegendaryDogsDogPack1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public class LegendaryDogsDogPack1 : IPart
//
public LegendaryDogsDogPack1()
{
base.Name = "LegendaryDogsDogPack1";
}

//
Expand Down
7 changes: 1 addition & 6 deletions LegendaryDogsGenerateFriendOrFoe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace XRL.World.Parts
{
public class LegendaryDogsGenerateFriendOrFoe : GenerateFriendOrFoe
public class LegendaryDogsGenerateFriendOrFoe
{
private static List<string> _hateReasons;

Expand Down Expand Up @@ -75,10 +75,5 @@ public static string getLikeReason()
{
return _likeReasons.GetRandomElement().Replace("$noun", Grammar.Pluralize(HistoricStringExpander.ExpandString("<spice.nouns.!random>")));
}

public static string getRandomFaction(GameObject parent)
{
return GenerateFriendOrFoe.getRandomFaction(parent);
}
}
}
Loading

0 comments on commit c8b917a

Please sign in to comment.