Skip to content

Commit

Permalink
Bug fixes, give Worgs random likes/dislikes
Browse files Browse the repository at this point in the history
Bug fixes:
- Water ritual rep change popup now displays properly
- Invalid dog blueprints should no longer show up
  • Loading branch information
koboldunderlord authored Aug 31, 2019
1 parent cbbb061 commit 0caca90
Show file tree
Hide file tree
Showing 6 changed files with 210 additions and 159 deletions.
134 changes: 134 additions & 0 deletions LegendaryDogsDogBuilder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
using System;
using System.Collections.Generic;
using System.Text;
using XRL.Core;
using XRL.Rules;
using XRL.UI;
using XRL.World.Parts.Effects;

namespace XRL.World
{
public class LegendaryDogsDogBuilder
{
public static string[] MessyLiquids =
{
"blood-9999",
"sap-9999"
};

public static string[] Prefixes =
{
"be",
"ba",
"ta",
"to",
"ru",
"ro",
"te",
"ta",
"da",
"du",
"di",
"do",
"u",
"a",
"i",
"pu"
};

public static string[] Infixes =
{
"d",
"dd",
"m",
"mm",
"nn",
"n",
"p",
"pp",
"g",
"gg"
};

public static string[] Postfixes =
{
"y",
"o",
"a",
"i",
"us"
};

public static string[] Titles = {
"Playful",
"Exciting",
"Funny",
"Clever",
"Soft",
"Loyal",
"Wild",
"Energetic",
"Loveable",
"Messy",
"Clueless",
"Happy",
"Simple",
"Loving",
"Content",
"Good",
"Caring",
"Fluffy",
"Smooth",
"Warm",
"Awkward",
"Floppy-tongued",
"Stub-tailed"
};

public static string BuildGoodTitle()
{
StringBuilder VeryGoodBuilder = new StringBuilder();
int Chance = Stat.RandomCosmetic(1, 2);
if (Chance == 2)
{
VeryGoodBuilder.Append("Very");
Chance = Stat.RandomCosmetic(1, 2);
while (Chance == 2)
{
VeryGoodBuilder.Append(", Very");
Chance = Stat.RandomCosmetic(1, 2);
}
VeryGoodBuilder.Append(" ");
}
VeryGoodBuilder.Append("Good");

return VeryGoodBuilder.ToString();
}

public static string BuildName(string BaseName, string Title)
{
StringBuilder NameBuilder = new StringBuilder();
NameBuilder.Append("&M");
string Prefix = Prefixes.GetRandomElement();
NameBuilder.Append(char.ToUpper(Prefix[0]));
NameBuilder.Append(Prefix.Substring(1));

if (Stat.RandomCosmetic(1, 2) == 2)
{
NameBuilder.Append(Prefixes.GetRandomElement());
}
NameBuilder.Append(Infixes.GetRandomElement());
NameBuilder.Append(Postfixes.GetRandomElement());
NameBuilder.Append(" the ");
NameBuilder.Append(Title);
string[] DisplayName = BaseName.Split(' ');
foreach (string s in DisplayName)
{
NameBuilder.Append(" ");
NameBuilder.Append(s.Substring(0, 1).ToUpper());
NameBuilder.Append(s.Substring(1));
}
return NameBuilder.ToString();
}
}
}
129 changes: 6 additions & 123 deletions LegendaryDogsDogHero1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,77 +15,6 @@ public class LegendaryDogsDogHero1 : IPart
public int GoodFactionPenalty;
public string VeryGoodText;

public static string[] MessyLiquids = {
"blood-9999",
"sap-9999"
};

public static string[] Prefixes = {
"be",
"ba",
"ta",
"to",
"ru",
"ro",
"te",
"ta",
"da",
"du",
"di",
"do",
"u",
"a",
"i",
"pu"
};

public static string[] Infixes = {
"d",
"dd",
"m",
"mm",
"nn",
"n",
"p",
"pp",
"g",
"gg"
};

public static string[] Postfixes = {
"y",
"o",
"a",
"i",
"us"
};

public static string[] Titles = {
"Playful",
"Exciting",
"Funny",
"Clever",
"Soft",
"Loyal",
"Wild",
"Energetic",
"Loveable",
"Messy",
"Clueless",
"Happy",
"Simple",
"Loving",
"Content",
"Good",
"Caring",
"Fluffy",
"Smooth",
"Warm",
"Awkward",
"Floppy-tongued",
"Stub-tailed"
};

public LegendaryDogsDogHero1()
{
base.Name = "LegendaryDogsDogHero1";
Expand All @@ -107,27 +36,6 @@ public override void Register(GameObject Object)
Object.RegisterPartEvent(this, "AfterLookedAt");
}

public void ProcessGoodTitle(StringBuilder NameBuilder)
{
StringBuilder VeryGoodBuilder = new StringBuilder();
int Chance = Stat.RandomCosmetic(1, 2);
if (Chance == 2)
{
VeryGoodBuilder.Append("Very");
Chance = Stat.RandomCosmetic(1, 2);
while (Chance == 2)
{
VeryGoodBuilder.Append(", Very");
Chance = Stat.RandomCosmetic(1, 2);
}
VeryGoodBuilder.Append(" ");
}
VeryGoodBuilder.Append("Good");

VeryGoodText = VeryGoodBuilder.ToString().ToLower();
NameBuilder.Append(VeryGoodBuilder.ToString());
}

public void AddModifiers()
{
if (ParentObject.DisplayName.Contains("Playful")
Expand All @@ -143,7 +51,7 @@ public void AddModifiers()
|| ParentObject.DisplayName.Contains("Floppy-tongued"))
{
Description Desc = ParentObject.GetPart<Description>();
Desc.Short = Desc.Short + " =pronouns.Subjective= seems very silly.";
Desc._Short = Desc._Short + " =pronouns.Subjective= seems very silly.";

}
else if (ParentObject.DisplayName.Contains("Clever"))
Expand All @@ -170,7 +78,7 @@ public void AddModifiers()
}
else if (ParentObject.DisplayName.Contains("Messy"))
{
ParentObject.MakeBloody(MessyLiquids.GetRandomElement());
ParentObject.MakeBloody(LegendaryDogsDogBuilder.MessyLiquids.GetRandomElement());
}
else if (ParentObject.DisplayName.Contains("Happy"))
{
Expand Down Expand Up @@ -233,39 +141,14 @@ public override bool FireEvent(Event E)
}
bCreated = true;

StringBuilder NameBuilder = new StringBuilder();
NameBuilder.Append("&M");
string Prefix = Prefixes.GetRandomElement();
NameBuilder.Append(char.ToUpper(Prefix[0]));
NameBuilder.Append(Prefix.Substring(1));

if (Stat.RandomCosmetic(1, 2) == 2)
{
NameBuilder.Append(Prefixes.GetRandomElement());
}
NameBuilder.Append(Infixes.GetRandomElement());
NameBuilder.Append(Postfixes.GetRandomElement());
NameBuilder.Append(" the ");
string Title = Titles.GetRandomElement();
string Title = LegendaryDogsDogBuilder.Titles.GetRandomElement();
if (Title == "Good")
{
ProcessGoodTitle(NameBuilder);
Title = LegendaryDogsDogBuilder.BuildGoodTitle();
VeryGoodText = Title.ToLower();
}
else
{
NameBuilder.Append(Title);
}
string[] DisplayName = ParentObject.DisplayName.Split(' ');
foreach (string s in DisplayName)
{
NameBuilder.Append(" ");
NameBuilder.Append(s.Substring(0, 1).ToUpper());
NameBuilder.Append(s.Substring(1));
}

ParentObject.DisplayName = NameBuilder.ToString();
ParentObject.DisplayName = LegendaryDogsDogBuilder.BuildName(ParentObject.DisplayName, Title);
AddModifiers();
ParentObject.FireEvent(Event.New("LegendaryDogsDisplayNameSet"));
}
else if (E.ID == "BeforeDeathRemoval" && this.GoodFactionPenalty > 0)
{
Expand Down
Loading

0 comments on commit 0caca90

Please sign in to comment.