diff --git a/Assemblies/TorannMagic.dll b/Assemblies/TorannMagic.dll
index 673f4cda..6a4fd7c1 100644
Binary files a/Assemblies/TorannMagic.dll and b/Assemblies/TorannMagic.dll differ
diff --git a/Defs/AbilityDefs/Abilities_TMagic_Priest.xml b/Defs/AbilityDefs/Abilities_TMagic_Priest.xml
index 9df9afd1..1ce521c3 100644
--- a/Defs/AbilityDefs/Abilities_TMagic_Priest.xml
+++ b/Defs/AbilityDefs/Abilities_TMagic_Priest.xml
@@ -68,7 +68,7 @@
.06
.3
true
-
+
TorannMagic.Verb_Purify
false
false
@@ -91,6 +91,107 @@
true
false
+
+
+
+ Cataract
+ HearingLoss
+ ToxicBuildup
+
+ 0
+ 0.4
+ 0.3
+
+
+
+ Asthma
+
+ 1
+ 10
+ Asthma
+
+
+
+ Blindness
+ Cirrhosis
+ ChemicalDamageModerate
+
+ 1
+ 0.3
+ 0.2
+
+
+
+ Frail
+ BadBack
+ Carcinoma
+ ChemicalDamageSevere
+
+ 2
+ 0.25
+ 0.2
+
+
+
+ Alzheimers
+ Dementia
+ HeartArteryBlockage
+ PsychicShock
+ CatatonicBreakdown
+
+ 3
+ 0.15
+ 0.15
+
+
+
+ Abasia
+
+ 3
+ true
+ 0.25
+ 0.05
+
+
+
+ AlcoholAddiction
+ SmokeleafAddiction
+
+ 0
+ 0.3
+ 0.3
+ true
+
+
+
+ GoJuiceAddiction
+ WakeUpAddiction
+
+ 1
+ 0.25
+ 0.25
+ true
+
+
+
+ PsychiteAddiction
+
+ 2
+ 0.25
+ 0.25
+ true
+
+
+
+ LuciferiumAddiction
+
+ 3
+ 0.15
+ 0.15
+ true
+ LuciferiumHigh
+
+
diff --git a/Source/TMagic/TMagic/ModOptions/TM_DebugTools.cs b/Source/TMagic/TMagic/ModOptions/TM_DebugTools.cs
index 9f3263d9..0ce0b93b 100644
--- a/Source/TMagic/TMagic/ModOptions/TM_DebugTools.cs
+++ b/Source/TMagic/TMagic/ModOptions/TM_DebugTools.cs
@@ -83,6 +83,19 @@ public static void RemoveClass(Pawn pawn)
}
}
+ [DebugAction("RWoM", "Grant 1000 XP", actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
+ public static void Grant1000XP(Pawn pawn)
+ {
+ if (pawn == null)
+ return;
+
+ CompAbilityUserMagic compMagic = pawn.GetComp();
+ if (compMagic == null)
+ return;
+
+ compMagic.MagicUserXP += 1000;
+ }
+
public static void RemoveClassHediffs(Pawn pawn)
{
List rhd = new List();
diff --git a/Source/TMagic/TMagic/TorannMagic.csproj b/Source/TMagic/TMagic/TorannMagic.csproj
index fe97365c..c29f6bce 100644
--- a/Source/TMagic/TMagic/TorannMagic.csproj
+++ b/Source/TMagic/TMagic/TorannMagic.csproj
@@ -173,6 +173,7 @@
+
diff --git a/Source/TMagic/TMagic/VerbProperties_Purify.cs b/Source/TMagic/TMagic/VerbProperties_Purify.cs
new file mode 100644
index 00000000..f74fc87e
--- /dev/null
+++ b/Source/TMagic/TMagic/VerbProperties_Purify.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using RimWorld;
+using AbilityUser;
+using Verse;
+using UnityEngine;
+
+namespace TorannMagic
+{
+ public class VerbProperties_Purify : AbilityUser.VerbProperties_Ability
+ {
+ public class HealableHediffParameters
+ {
+ public List hediffs = new List();
+ public int minLevel = 0;
+ public float baseAmount = 0.0f;
+ public float amountPerLevel = 0.0f;
+ public bool useArcaneDamage = false;
+ public bool isRemovalChance = false;
+ public string alsoRemoveOnFullHeal = "";
+ }
+
+ public List healableHediffs = new List();
+ }
+}
diff --git a/Source/TMagic/TMagic/Verb_Purify.cs b/Source/TMagic/TMagic/Verb_Purify.cs
index d5a5e11b..7b88fa26 100644
--- a/Source/TMagic/TMagic/Verb_Purify.cs
+++ b/Source/TMagic/TMagic/Verb_Purify.cs
@@ -15,6 +15,8 @@ public class Verb_Purify : Verb_UseAbility
private int pwrVal;
float arcaneDmg = 1f;
+ public VerbProperties_Purify Props => (VerbProperties_Purify)UseAbilityProps;
+
bool validTarg;
//Used for non-unique abilities that can be used with shieldbelt
public override bool CanHitTargetFrom(IntVec3 root, LocalTargetInfo targ)
@@ -68,13 +70,13 @@ protected override bool TryCastShot()
bool flag = pawn != null && !pawn.Dead;
if (flag)
{
- int num = Mathf.RoundToInt(1f + (.4f * verVal));
+ int numberOfThingsToHeal = Mathf.RoundToInt(1f + (.4f * verVal));
using (IEnumerator enumerator = pawn.health.hediffSet.GetInjuredParts().GetEnumerator())
{
while (enumerator.MoveNext())
{
BodyPartRecord rec = enumerator.Current;
- bool flag2 = num > 0;
+ bool flag2 = numberOfThingsToHeal > 0;
if (flag2)
{
int num2 = 1 + verVal;
@@ -96,7 +98,7 @@ protected override bool TryCastShot()
if (pwrVal >= 1)
{
current.Heal(pwrVal * arcaneDmg);
- num--;
+ numberOfThingsToHeal--;
num2--;
}
}
@@ -104,7 +106,7 @@ protected override bool TryCastShot()
{
current.Heal((2f + pwrVal * 2) * arcaneDmg);
//current.Heal(5.0f + (float)pwrVal * 3f); // power affects how much to heal
- num--;
+ numberOfThingsToHeal--;
num2--;
}
TM_MoteMaker.ThrowRegenMote(pawn.Position.ToVector3Shifted(), pawn.Map, .6f);
@@ -116,94 +118,61 @@ protected override bool TryCastShot()
}
}
}
- //if (pawn.RaceProps.Humanlike)
- //{
- using (IEnumerator enumerator = pawn.health.hediffSet.GetHediffs().GetEnumerator())
+
+ if (numberOfThingsToHeal > 0)
{
- while (enumerator.MoveNext())
+ foreach (Hediff hediff in pawn.health.hediffSet.GetHediffs())
{
- Hediff rec = enumerator.Current;
- bool flag2 = num > 0;
- if (flag2)
+ if (numberOfThingsToHeal <= 0)
+ break;
+
+ string hediffName = hediff.def.defName;
+
+ // Look up healable parameters and see if there is an entry for this hediff
+ VerbProperties_Purify.HealableHediffParameters healableParameters = Props.healableHediffs.Find(hh => hh.hediffs.Contains(hediffName));
+ if (healableParameters == null)
+ continue;
+
+ // Make sure we are capable of healing it
+ if (verVal < healableParameters.minLevel)
+ continue;
+
+ float healAmount = (healableParameters.baseAmount + (healableParameters.amountPerLevel * pwrVal));
+ if (healableParameters.useArcaneDamage)
+ healAmount *= arcaneDmg;
+
+ // Is the heal amount just a chance to fully remove?
+ if (healableParameters.isRemovalChance)
{
- if (rec.def.defName == "Cataract" || rec.def.defName == "HearingLoss" || rec.def.defName.Contains("ToxicBuildup"))
- {
- rec.Heal(.4f + .3f * pwrVal);
- num--;
- }
- if ((rec.def.defName == "Blindness" || rec.def.defName.Contains("Asthma") || rec.def.defName == "Cirrhosis" || rec.def.defName == "ChemicalDamageModerate") && verVal >= 1)
- {
- rec.Heal(.3f + .2f * pwrVal);
- if (rec.def.defName.Contains("Asthma"))
- {
- pawn.health.RemoveHediff(rec);
- }
- num--;
- }
- if ((rec.def.defName == "Frail" || rec.def.defName == "BadBack" || rec.def.defName.Contains("Carcinoma") || rec.def.defName == "ChemicalDamageSevere") && verVal >= 2)
- {
- rec.Heal(.25f + .2f * pwrVal);
- num--;
- }
- if ((rec.def.defName.Contains("Alzheimers") || rec.def.defName == "Dementia" || rec.def.defName.Contains("HeartArteryBlockage") || rec.def.defName == "PsychicShock" || rec.def.defName == "CatatonicBreakdown") && verVal >= 3)
- {
- rec.Heal(.15f + .15f * pwrVal);
- num--;
- }
- if(rec.def.defName.Contains("Abasia") && verVal >= 3)
+ //Log.Message(String.Format("{0}: {1} heal chance {2}", pawn, hediff.def.defName, healAmount));
+ if (Rand.Chance(healAmount))
{
- if(Rand.Chance(.25f + (.05f * pwrVal)))
- {
- pawn.health.RemoveHediff(pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("Abasia")));
- num--;
- }
- else
- {
- MoteMaker.ThrowText(pawn.DrawPos, pawn.Map, "Failed to remove Abasia...");
- }
+ //Log.Message(String.Format("{0}: {1} heal successful!", pawn, hediff.def.defName));
+ pawn.health.RemoveHediff(hediff);
}
- TM_MoteMaker.ThrowRegenMote(pawn.Position.ToVector3Shifted(), pawn.Map, .6f);
- TM_MoteMaker.ThrowRegenMote(pawn.Position.ToVector3Shifted(), pawn.Map, .4f);
}
- }
- }
- //}
- using (IEnumerator enumerator = pawn.health.hediffSet.GetHediffs().GetEnumerator())
- {
- while (enumerator.MoveNext())
- {
- Hediff_Addiction rec = enumerator.Current;
- bool flag2 = num > 0;
- if (flag2)
+ // Otherwise lower the severity by the heal amount
+ else
{
- if (rec.Chemical.defName == "Alcohol" || rec.Chemical.defName == "Smokeleaf")
+ // If something else should be removed on a full heal
+ if (!string.IsNullOrEmpty(healableParameters.alsoRemoveOnFullHeal) && hediff.Severity <= healAmount)
{
- rec.Severity -= ((.3f + .3f * pwrVal)*arcaneDmg);
- num--;
- }
- if ((rec.Chemical.defName == "GoJuice" || rec.Chemical.defName == "WakeUp") && verVal >= 1)
- {
- rec.Severity -= ((.25f + .25f * pwrVal)*arcaneDmg);
- num--;
- }
- if (rec.Chemical.defName == "Psychite" && verVal >= 2)
- {
- rec.Severity -= ((.25f + .25f * pwrVal)*arcaneDmg);
- num--;
- }
- if (verVal >= 3)
- {
- if (rec.Chemical.defName == "Luciferium" && (rec.Severity - ((.15f + .15f * pwrVal)*arcaneDmg) < 0))
+ Hediff firstHediffOfDef = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named(healableParameters.alsoRemoveOnFullHeal));
+ if (firstHediffOfDef != null)
{
- Hediff luciHigh = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("LuciferiumHigh"), false);
- pawn.health.RemoveHediff(luciHigh);
+ //Log.Message(String.Format("{0}: {1} removed", pawn, healableParameters.alsoRemoveOnFullHeal));
+ pawn.health.RemoveHediff(firstHediffOfDef);
}
- rec.Severity -= ((.15f + .15f * pwrVal) * arcaneDmg);
- num--;
}
- TM_MoteMaker.ThrowRegenMote(pawn.Position.ToVector3Shifted(), pawn.Map, .6f);
- TM_MoteMaker.ThrowRegenMote(pawn.Position.ToVector3Shifted(), pawn.Map, .4f);
+
+ //Log.Message(String.Format("{0}: {1} being healed by {2}", pawn, hediff.def.defName, healAmount));
+ hediff.Heal(healAmount);
}
+
+ TM_MoteMaker.ThrowRegenMote(pawn.Position.ToVector3Shifted(), pawn.Map, 0.6f);
+ TM_MoteMaker.ThrowRegenMote(pawn.Position.ToVector3Shifted(), pawn.Map, 0.4f);
+
+ --numberOfThingsToHeal;
}
}
}