Skip to content

Commit

Permalink
Fixes Rim-Of-Madness-Team/Rim-of-Madness---Vampire#6
Browse files Browse the repository at this point in the history
+Fixed issue with friendly fire false settings ending up to attack friendly fire targets.
+Adds XML options for refunding of cooldowns and points for special failures of abilities.
  • Loading branch information
jecrell committed Feb 5, 2018
1 parent 73e8832 commit 557ebf1
Show file tree
Hide file tree
Showing 10 changed files with 632 additions and 426 deletions.
2 changes: 1 addition & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<url></url>
<targetVersion>0.18.0</targetVersion>
<description>
[1.0.8.8] Adds modding components to RimWorld: vehicles, spell casting, weapon slots, oversized weapons, and more!
[1.0.8.9] Adds modding components to RimWorld: vehicles, spell casting, weapon slots, oversized weapons, and more!

Note to players: This mod will not change your game, but rather it lets modders do more, so you can have an even more amazing RimWorld experience.

Expand Down
Binary file modified Assemblies/0JecsTools.dll
Binary file not shown.
Binary file modified Assemblies/AbilityUser.dll
Binary file not shown.
Binary file modified Assemblies/AbilityUserAI.dll
Binary file not shown.
2 changes: 2 additions & 0 deletions Languages/English/Keyed/AbilityUser.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<LanguageData>

<AU_NoTargets>No targets available.</AU_NoTargets>

<AU_DISABLED>DISABLED</AU_DISABLED>

<AU_Type>Type: </AU_Type>
Expand Down
1,019 changes: 609 additions & 410 deletions Source/.idea/.idea.JecsTools/.idea/workspace.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,6 @@ public class JobDriver_CastAbilityVerb : JobDriver
{
public AbilityContext Context => job.count == 1 ? AbilityContext.Player : AbilityContext.AI;


private List<CompAbilityUser> CompAbilityUsers
{
get
{
var results = new List<CompAbilityUser>();
var allCompAbilityUsers = pawn.GetComps<CompAbilityUser>();
if (allCompAbilityUsers.TryRandomElement(out var comp))
foreach (var compy in allCompAbilityUsers)
results.Add(compy);
return results;
}
}

public override bool TryMakePreToilReservations()
{
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ public int CooldownTicksLeft
set => TicksUntilCasting = value;
} //Log.Message(value.ToString()); } }

public virtual void Notify_AbilityFailed(bool refund)
{
if (refund)
CooldownTicksLeft = -1;
}

public int MaxCastingTicks => (int) (powerdef.MainVerb.SecondsToRecharge * GenTicks.TicksPerRealSecond);

public Verb_UseAbility Verb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected virtual void UpdateTargets()
targets = caster.Map.listerThings.AllThings.Where(x =>
x.Position.InHorDistOf(aoeStartPosition, UseAbilityProps.TargetAoEProperties.range) &&
UseAbilityProps.TargetAoEProperties.targetClass.IsAssignableFrom(x.GetType()) &&
!x.Faction.HostileTo(Faction.OfPlayer)).ToList();
x.Faction.HostileTo(Faction.OfPlayer)).ToList();
}
else if (UseAbilityProps.TargetAoEProperties.targetClass == typeof(Plant) ||
UseAbilityProps.TargetAoEProperties.targetClass == typeof(Building))
Expand Down Expand Up @@ -106,6 +106,12 @@ protected override bool TryCastShot()
var burstShots = ShotsPerBurst;
if (UseAbilityProps.AbilityTargetCategory != AbilityTargetCategory.TargetAoE && TargetsAoE.Count > 1)
TargetsAoE.RemoveRange(0, TargetsAoE.Count - 1);
if (UseAbilityProps.mustHaveTarget && TargetsAoE.Count == 0)
{
Messages.Message("AU_NoTargets".Translate(), MessageTypeDefOf.RejectInput);
Ability.Notify_AbilityFailed(true);
return false;
}
for (var i = 0; i < TargetsAoE.Count; i++)
{
// for (int j = 0; j < burstshots; j++)
Expand All @@ -126,6 +132,10 @@ protected override bool TryCastShot()
//{
//}
PostCastShot(result, out result);
if (result == false)
{
Ability.Notify_AbilityFailed(UseAbilityProps.refundsPointsAfterFailing);
}
return result;
//bool result = false;
//this.TargetsAoE.Clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public class VerbProperties_Ability : VerbProperties

public bool AlwaysHits = true;

public bool mustHaveTarget = false;
public bool refundsPointsAfterFailing = false;

public bool canCastInMelee = true;

public List<ExtraDamage> extraDamages = null;
Expand Down

0 comments on commit 557ebf1

Please sign in to comment.