Skip to content

Commit

Permalink
1.18.0.2 May Update
Browse files Browse the repository at this point in the history
- Only "blooded" werewolves transform when raiding.
- Reduced chance of guest werewolves transforming during a full moon to 2%
- Added notification for when werewolves arrive on the map.
  • Loading branch information
jecrell committed May 2, 2018
1 parent 68da32a commit b32c792
Show file tree
Hide file tree
Showing 14 changed files with 110 additions and 13 deletions.
3 changes: 2 additions & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
<name>Rim of Madness - Werewolves</name>
<author>Jecrell</author>
<targetVersion>0.18.0</targetVersion>
<url>https://discord.gg/AaVFA7V</url>
<description>
V1.18.0.1
V1.18.0.2 (May, 2018)
Adds Werewolves to RimWorld.

Quick Werewolf Guide
Expand Down
Binary file modified Assemblies/Werewolf.dll
Binary file not shown.
7 changes: 4 additions & 3 deletions Defs/FactionDefs/FactionDefs_Werewolf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@
<!-- Base defense -->
<kindDef>FactionBase</kindDef>
<options>
<ROM_WerewolfNewBlood>15</ROM_WerewolfNewBlood>
<ROM_WolfHandler>100</ROM_WolfHandler>
<ROM_Werewolf>500</ROM_Werewolf>
<ROM_WerewolfStraggler>15</ROM_WerewolfStraggler>
<ROM_WerewolfNewBlood>25</ROM_WerewolfNewBlood>
<ROM_WolfHandler>35</ROM_WolfHandler>
<ROM_Werewolf>50</ROM_Werewolf>
<ROM_WerewolfFang>100</ROM_WerewolfFang>
<ROM_WerewolfAlpha>1</ROM_WerewolfAlpha>
</options>
Expand Down
33 changes: 29 additions & 4 deletions Defs/PawnKindDefs/PawnKinds_Werewolf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,35 @@
<invFoodDef>Pemmican</invFoodDef>
</PawnKindDef>

<PawnKindDef ParentName="WerewolfBase">
<defName>ROM_WerewolfStraggler</defName>
<label>straggler</label>
<combatPower>50</combatPower>
<maxGenerationAge>25</maxGenerationAge>
<gearHealthRange>
<min>0.5</min>
<max>1.8</max>
</gearHealthRange>
<apparelMoney>
<min>180</min>
<max>350</max>
</apparelMoney>
<apparelTags>
<li>Tribal</li>
</apparelTags>
<weaponMoney>
<min>60</min>
<max>400</max>
</weaponMoney>
<weaponTags>
<li>NeolithicMeleeBasic</li>
</weaponTags>
</PawnKindDef>

<PawnKindDef ParentName="WerewolfBase">
<defName>ROM_WerewolfNewBlood</defName>
<label>newblood</label>
<combatPower>50</combatPower>
<combatPower>200</combatPower>
<maxGenerationAge>25</maxGenerationAge>
<gearHealthRange>
<min>0.5</min>
Expand All @@ -40,7 +65,7 @@
<PawnKindDef ParentName="WerewolfBase">
<defName>ROM_WolfHandler</defName>
<label>companion</label>
<combatPower>290</combatPower>
<combatPower>600</combatPower>
<invNutrition>2.5</invNutrition>
<gearHealthRange>
<min>0.5</min>
Expand All @@ -65,7 +90,7 @@
<PawnKindDef ParentName="WerewolfBase">
<defName>ROM_Werewolf</defName>
<label>claw</label>
<combatPower>500</combatPower>
<combatPower>700</combatPower>
<invNutrition>2.5</invNutrition>
<gearHealthRange>
<min>0.5</min>
Expand All @@ -90,7 +115,7 @@
<PawnKindDef ParentName="WerewolfBase">
<defName>ROM_WerewolfFang</defName>
<label>fang</label>
<combatPower>750</combatPower>
<combatPower>850</combatPower>
<gearHealthRange>
<min>0.5</min>
<max>1.8</max>
Expand Down
8 changes: 8 additions & 0 deletions Languages/English/Keyed/ROMWW_Keyed.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<LanguageData>

<ROM_WerewolfEncounterLabel>Werewolf Incoming</ROM_WerewolfEncounterLabel>
<ROM_WerewolfEncounterDesc>{0} is a werewolf. Silver weapons or special tactics may be required if they become hostile.</ROM_WerewolfEncounterDesc>


<!-- 4/29/18 -->
<ROM_WerewolfTransformationFailure>{0} failed to transform. (Reason: outside home. 2% success rate)</ROM_WerewolfTransformationFailure>

<!-- Prior -->
<ROM_WerewolfEscaped>{0} has leaped forth from its containment in the {1}.</ROM_WerewolfEscaped>
<ROM_WerewolfLimbRegen>{0} has regenerated their {1}.</ROM_WerewolfLimbRegen>
<ROM_WerewolfDecyberize>{0} has regenerated their {1} and lost their {2} in the process.</ROM_WerewolfDecyberize>
Expand Down
2 changes: 1 addition & 1 deletion Source/AI/JobGiver_ManageWerewolfForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected override Job TryGiveJob(Pawn pawn)

if (pawn.GetComp<CompWerewolf>() is CompWerewolf w && w.IsWerewolf)
{
if (!w.IsTransformed) w.TransformInto(w.HighestLevelForm, false);
if (!w.IsTransformed && w.IsBlooded) w.TransformInto(w.HighestLevelForm, false);
}

if (verb.verbProps.MeleeRange)
Expand Down
19 changes: 18 additions & 1 deletion Source/CompWerewolf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,23 @@ public void TransformInto(WerewolfForm form, bool moonTransformation = false)
isReverting = false;
}

public override float CombatPoints()
{
//Log.Message("Combat points called");
if (forbiddenWolfhood) return 0;
if (WerewolfForms.NullOrEmpty()) return 400;
var combatPoints = WerewolfForms.Max(x => x.level) * 400;
//Log.Message("combatPoints: " + combatPoints);
return combatPoints;
}

private bool forbiddenWolfhood = false;
public override void DisableAbilityUser()
{
Pawn.story.traits.allTraits.Remove(WerewolfTrait);
forbiddenWolfhood = true;
}

/// Gives a random new transformation from full moon furies.
public void TransformRandom(bool moonTransformation)
{
Expand Down Expand Up @@ -705,7 +722,7 @@ public void ResolveAIHostileReaction()
/// Give AI Werewolves levels in different forms.
public void ResolveAIFactionSpawns()
{
if (!factionResolved && Pawn?.Faction?.def?.defName == "ROM_WerewolfClan")
if (!factionResolved && Pawn?.Faction?.def?.defName == "ROM_WerewolfClan" && Pawn?.kindDef?.defName != "ROM_WerewolfStraggler" && !forbiddenWolfhood)
{
factionResolved = true;

Expand Down
13 changes: 11 additions & 2 deletions Source/GameCondition_FullMoon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,24 @@ public override void GameConditionTick()
m.TryGainMemory(WWDefOf.ROMWW_SawFullMoon);
}

if (pawn?.GetComp<CompWerewolf>() is CompWerewolf w && w.IsWerewolf && !w.IsTransformed && (!w.IsBlooded || w.FuryToggled))
if (pawn?.GetComp<CompWerewolf>() is CompWerewolf w && ShouldTransform(pawn, w))
{
w.TransformRandom(true);
if (pawn.Faction == Faction.OfPlayerSilentFail)
w.TransformRandom(true);
else if (Rand.Value <= 0.02) //2% chance of messing up your colony
w.TransformRandom(true);
else
Messages.Message("ROM_WerewolfTransformationFailure".Translate(pawn), MessageTypeDefOf.CautionInput);
}
}
}
}
}

private bool ShouldTransform(Pawn pawn, CompWerewolf w) => w.IsWerewolf && !w.IsTransformed &&
(!w.IsBlooded || w.FuryToggled) &&
!pawn.PositionHeld.Fogged(pawn.MapHeld);

public override void End()
{
Messages.Message("ROM_MoonCycle_FullMoonPasses".Translate(Moon.Name), MessageTypeDefOf.NeutralEvent);//MessageSound.Standard);
Expand Down
12 changes: 12 additions & 0 deletions Source/HarmonyPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,21 @@ static HarmonyPatches()
.Where(mi => mi.GetParameters().Count() >= 4 &&
mi.GetParameters().ElementAt(1).ParameterType == typeof(Hediff_Injury)).First()),
new HarmonyMethod(typeof(HarmonyPatches), nameof(WerewolfDmgFixFinalizeAndAddInjury)), null);
harmony.Patch(AccessTools.Method(typeof(Scenario), "Notify_PawnGenerated"), null,
new HarmonyMethod(typeof(HarmonyPatches), nameof(AddRecentWerewolves)));

}

// RimWorld.Scenario
public static void AddRecentWerewolves(Scenario __instance, Pawn pawn, PawnGenerationContext context)
{
if (pawn.IsWerewolf())
{
var recentWerewolves = Find.World.GetComponent<WorldComponent_MoonCycle>().recentWerewolves;
recentWerewolves?.Add(pawn, 1);
}
}

public static bool ShouldModifyDamage(Pawn instigator)
{
if (!instigator?.TryGetComp<CompWerewolf>()?.IsTransformed ?? false)
Expand Down
21 changes: 21 additions & 0 deletions Source/WorldComponent_MoonCycle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public void GenerateMoons(World world)
}
}

public Dictionary<Pawn, int> recentWerewolves = new Dictionary<Pawn, int>();


public override void WorldComponentTick()
{
base.WorldComponentTick();
Expand All @@ -89,6 +92,24 @@ public override void WorldComponentTick()
gcMoonCycle.Permanent = true;
Find.World.gameConditionManager.RegisterCondition(gcMoonCycle);
}

if (recentWerewolves.Any())
recentWerewolves.RemoveAll(x => x.Key.Dead || x.Key.DestroyedOrNull());
if (recentWerewolves.Any())
{
var recentVampiresKeys = new List<Pawn>(recentWerewolves.Keys);
foreach (var key in recentVampiresKeys)
{
recentWerewolves[key] += 1;
if (recentWerewolves[key] > 100)
{
recentWerewolves.Remove(key);
if (!key.Spawned || key.Faction == Faction.OfPlayerSilentFail) continue;
Find.LetterStack.ReceiveLetter("ROM_WerewolfEncounterLabel".Translate(),
"ROM_WerewolfEncounterDesc".Translate(key.LabelShort), LetterDefOf.ThreatSmall, key, null);
}
}
}
}


Expand Down
2 changes: 1 addition & 1 deletion Source/obj/Debug/CoreCompileInputs.cache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
64948376f0173574a85b3ceb614495a88b48d1d3
5f9842ea24284a32eed25e22b07a3f36e12bc08f
3 changes: 3 additions & 0 deletions Source/obj/Debug/Werewolf.csproj.FileListAbsolute.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ D:\SteamLibrary\steamapps\common\RimWorld\Mods\Rim-of-Madness---Werewolves\Sourc
D:\SteamLibrary\steamapps\common\RimWorld\ModsWorkspace\Rim-of-Madness---Werewolves\Assemblies\Werewolf.dll
D:\SteamLibrary\steamapps\common\RimWorld\ModsWorkspace\Rim-of-Madness---Werewolves\Source\obj\Debug\Werewolf.csprojResolveAssemblyReference.cache
D:\SteamLibrary\steamapps\common\RimWorld\ModsWorkspace\Rim-of-Madness---Werewolves\Source\obj\Debug\Werewolf.dll
C:\Program Files (x86)\Steam\steamapps\common\RimWorld\ModsWorkspace\Rim-of-Madness---Werewolves\Assemblies\Werewolf.dll
C:\Program Files (x86)\Steam\steamapps\common\RimWorld\ModsWorkspace\Rim-of-Madness---Werewolves\Source\obj\Debug\Werewolf.csprojResolveAssemblyReference.cache
C:\Program Files (x86)\Steam\steamapps\common\RimWorld\ModsWorkspace\Rim-of-Madness---Werewolves\Source\obj\Debug\Werewolf.dll
Binary file modified Source/obj/Debug/Werewolf.csprojResolveAssemblyReference.cache
Binary file not shown.
Binary file modified Source/obj/Debug/Werewolf.dll
Binary file not shown.

0 comments on commit b32c792

Please sign in to comment.