Skip to content

Commit

Permalink
Fix incident Ransomwares ( add bad trait for androids and prevent app…
Browse files Browse the repository at this point in the history
…earing if no bad trait added)
  • Loading branch information
aRandomKiwi committed Aug 1, 2021
1 parent 4eaca37 commit eb3c2e2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
Binary file modified 1.3/Assemblies/AndroidTiers.dll
Binary file not shown.
16 changes: 14 additions & 2 deletions Source/Androids For RW1.3/Incidents/Incident_RansomWare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,15 @@ protected override bool TryExecuteWorker(IncidentParms parms)
//Bad traits added
if (Rand.Chance(0.5f))
{
List<TraitDef> tr = Utils.RansomAddedBadTraits.ToList();
List<TraitDef> tr;
if (victim.IsAndroid())
tr = Utils.RansomAddedBadTraitsAndroid.ToList();
else
tr = Utils.RansomAddedBadTraits.ToList();


//Purge des traits deja possédé par la victime ET incompatibles avec ceux present
foreach(var t in Utils.RansomAddedBadTraits)
foreach (var t in Utils.RansomAddedBadTraits)
{
foreach(var t2 in victim.story.traits.allTraits)
{
Expand All @@ -72,6 +77,13 @@ protected override bool TryExecuteWorker(IncidentParms parms)
cso.ransomwareTraitAdded = tr.RandomElement();
victim.story.traits.GainTrait(new Trait(cso.ransomwareTraitAdded, 0, true));

//If trait is disabled or cannot be applied then we cancel this incident
if (!victim.story.traits.HasTrait(cso.ransomwareTraitAdded))
{
cso.clearRansomwareVar();
return false;
}

fee = Rand.Range(Settings.ransomwareMinSilverToPayForBasTrait, Settings.ransomwareMaxSilverToPayForBasTrait);

string traitLabel="";
Expand Down
9 changes: 9 additions & 0 deletions Source/Androids For RW1.3/Utils/GC_ATPP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,15 @@ public GC_ATPP(Game game)
Utils.RansomAddedBadTraits.Add(t);
}

selTraits = new List<string> { "Brawler", "Ascetic", "Gourmand", "SlowLearner", "Undergrounder", "DislikesMen", "DislikesWomen" };

foreach (var st in selTraits)
{
t = DefDatabase<TraitDef>.GetNamed(st, false);
if (t != null)
Utils.RansomAddedBadTraitsAndroid.Add(t);
}

//Si presence HellUnit ajout schema creation surrogate, sinon suppression recipedefs
RecipeDef recipHU = DefDatabase<RecipeDef>.GetNamed("ATPP_CreateHellDrone");
ThingDef tdHU = DefDatabase<ThingDef>.GetNamed("ATPP_SHUSurrogateGeneratorAI");
Expand Down
3 changes: 2 additions & 1 deletion Source/Androids For RW1.3/Utils/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ public static class Utils
public static List<MentalBreakDef> VirusedRandomMentalBreak = new List<MentalBreakDef>();

public static List<TraitDef> RansomAddedBadTraits = new List<TraitDef>();

public static List<TraitDef> RansomAddedBadTraitsAndroid = new List<TraitDef>();

//public static Color SXColor = new Color(0.463f, 0.62f, 0.463f);
public static Color SXColor = new Color(0.280f, 0.280f, 0.280f);

Expand Down
Binary file modified Source/Androids For RW1.3/obj/Debug/AndroidTiers.dll
Binary file not shown.

0 comments on commit eb3c2e2

Please sign in to comment.