Skip to content

Commit

Permalink
Linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Vek17 committed Oct 9, 2022
1 parent 95a832e commit 31cf0c2
Show file tree
Hide file tree
Showing 26 changed files with 69 additions and 101 deletions.
24 changes: 12 additions & 12 deletions TabletopTweaks-Base/Bugfixes/Abilities/Spells.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ static void Postfix() {
PatchAcidMaw();
PatchAnimalGrowth();
PatchBestowCurseGreater();
PatchBreakEnchantment();
PatchBreakEnchantment();
PatchChainLightning();
PatchCommand();
PatchCommandGreater();
PatchCrusadersEdge();
PatchDeathWard();
PatchDispelMagicGreater();
PatchFirebrand();
PatchFirebrand();
PatchFlamestrike();
PatchFrightfulAspect();
PatchGeniekind();
Expand All @@ -108,7 +108,7 @@ static void Postfix() {
PatchRemoveSickness();
PatchShadowConjuration();
PatchShadowEvocation();
PatchShadowEvocationGreater();
PatchShadowEvocationGreater();
PatchUnbreakableHeart();
PatchWrachingRay();
PatchFromSpellFlags();
Expand Down Expand Up @@ -382,7 +382,7 @@ static void PatchBurstOfSonicEnergy() {
var BurstOfSonicEnergy = BlueprintTools.GetBlueprint<BlueprintAbility>("b5a2d0e400dd38e428c953f8a2be5f0b");
var BurstOfSonicEnergy10Feet = BlueprintTools.GetBlueprint<BlueprintAbility>("980554934d1aa354bbb08f4b150bd9da");
var BurstOfSonicEnergyAdjacent = BlueprintTools.GetBlueprint<BlueprintAbility>("65010ad20b1f57a4f86cd09115728831");
var Mythic1lvlAzata_ElysiumBolt00 = BlueprintTools.GetBlueprintReference<BlueprintProjectileReference>("f00eb27234fbc39448b142f1257c8886");
var Mythic1lvlAzata_ElysiumBolt00 = BlueprintTools.GetBlueprintReference<BlueprintProjectileReference>("f00eb27234fbc39448b142f1257c8886");

BurstOfSonicEnergy.TemporaryContext(bp => {
bp.AvailableMetamagic |= Metamagic.Empower
Expand All @@ -394,7 +394,7 @@ static void PatchBurstOfSonicEnergy() {
| (Metamagic)CustomMetamagic.ElementalCold
| (Metamagic)CustomMetamagic.ElementalElectricity
| (Metamagic)CustomMetamagic.ElementalFire;
bp.GetComponent<AbilityEffectRunAction>().TemporaryContext(c => {
bp.GetComponent<AbilityEffectRunAction>().TemporaryContext(c => {
c.Actions = Helpers.CreateActionList(
new Conditional() {
ConditionsChecker = new ConditionsChecker() {
Expand Down Expand Up @@ -718,11 +718,11 @@ static void PatchRepulsiveNature() {
);
c.Deactivated = Helpers.CreateActionList();
c.NewRound = Helpers.CreateActionList(
new ContextActionSavingThrow() {
new ContextActionSavingThrow() {
Type = SavingThrowType.Fortitude,
CustomDC = new ContextValue(),
Actions = Helpers.CreateActionList(
new ContextActionConditionalSaved() {
new ContextActionConditionalSaved() {
Succeed = Helpers.CreateActionList(
new ContextActionApplyBuff() {
m_Buff = RepulsiveNatureBuffImmunity.ToReference<BlueprintBuffReference>(),
Expand Down Expand Up @@ -955,7 +955,7 @@ static void PatchWaterTorrent() {
bp.SetDescription(WaterTorrent.m_Description);
});
TTTContext.Logger.LogPatch(WaterTorrent);
}
}
static void PatchWindsOfFall() {
if (Main.TTTContext.Fixes.Spells.IsDisabled("WindsOfFall")) { return; }

Expand Down Expand Up @@ -1144,7 +1144,7 @@ static void PatchAnimalGrowth() {
}
TTTContext.Logger.LogPatch("Patched", bp);
});
}
}
static void PatchBestowCurseGreater() {
if (Main.TTTContext.Fixes.Spells.IsDisabled("BestowCurseGreater")) { return; }

Expand Down Expand Up @@ -1204,7 +1204,7 @@ static void PatchBreakEnchantment() {
dispel.m_MaxSpellLevel = new ContextValue();
});
TTTContext.Logger.LogPatch("Patched", BreakEnchantment);
}
}
static void PatchChainLightning() {
if (Main.TTTContext.Fixes.Spells.IsDisabled("ChainLightning")) { return; }

Expand Down Expand Up @@ -1248,7 +1248,7 @@ static void PatchCommandGreater() {
descriptors.Descriptor = SpellDescriptor.MindAffecting | SpellDescriptor.Compulsion;
TTTContext.Logger.LogPatch(ability);
});
}
}
static void PatchCrusadersEdge() {
if (Main.TTTContext.Fixes.Spells.IsDisabled("CrusadersEdge")) { return; }

Expand Down Expand Up @@ -1560,7 +1560,7 @@ static void PatchWrachingRay() {
}
}
TTTContext.Logger.LogPatch("Patched", WrackingRay);
}
}
static void PatchFromSpellFlags() {
if (Main.TTTContext.Fixes.Spells.IsDisabled("FixSpellFlags")) { return; }

Expand Down
2 changes: 1 addition & 1 deletion TabletopTweaks-Base/Bugfixes/Classes/Alchemist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static void PatchAlternateCapstone() {
add.m_Features.RemoveAll(f => f.deserializedGuid == VivsectionistDiscoverySelection.AssetGuid);
});
});

TTTContext.Logger.LogPatch("Enabled Alternate Capstones", bp);
});
}
Expand Down
7 changes: 2 additions & 5 deletions TabletopTweaks-Base/Bugfixes/Classes/Arcanist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using Kingmaker.UnitLogic;
using Kingmaker.UnitLogic.Abilities;
using Kingmaker.Utility;
using Mono.Cecil.Cil;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -131,8 +130,7 @@ static bool Prefix(Spellbook __instance, AbilityData data, SpellSlot slot, ref b
__result = false;
return false;
}
if (__instance.Blueprint.IsArcanist && __instance.SureMemorizedSpells(spellLevel).HasItem(delegate (SpellSlot i)
{
if (__instance.Blueprint.IsArcanist && __instance.SureMemorizedSpells(spellLevel).HasItem(delegate (SpellSlot i) {
AbilityData spellShell = i.SpellShell;
return spellShell?.Blueprint == data.Blueprint && Equals(spellShell?.MetamagicData, data?.MetamagicData);
})) {
Expand All @@ -156,8 +154,7 @@ static bool Prefix(Spellbook __instance, AbilityData data, SpellSlot slot, ref b
spellSlot.LinkedSlots = memorizeSlots;
spellSlot.IsOpposition = (__instance.OppositionSchools.Contains(data.Blueprint.School) || __instance.OppositionDescriptors.HasAnyFlag(data.Blueprint.SpellDescriptor));
}
EventBus.RaiseEvent<ISpellBookUIHandler>(delegate (ISpellBookUIHandler h)
{
EventBus.RaiseEvent<ISpellBookUIHandler>(delegate (ISpellBookUIHandler h) {
h.HandleMemorizedSpell(data, __instance.Owner);
}, true);
__result = true;
Expand Down
2 changes: 1 addition & 1 deletion TabletopTweaks-Base/Bugfixes/Classes/Barbarian.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static void Postfix() {
PatchWreckingBlows();
PatchCripplingBlows();
}

static void PatchBase() {
}

Expand Down
4 changes: 2 additions & 2 deletions TabletopTweaks-Base/Bugfixes/Classes/Cleric.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static void PatchAlternateCapstone() {
});
}
}
[HarmonyPatch(typeof(BlueprintsCache), "Init")]
[HarmonyPatch(typeof(BlueprintsCache), "Init")]
static class BlueprintsCache_Init_Domain_Patch {
static bool Initialized;
[HarmonyPriority(Priority.First)]
Expand All @@ -47,7 +47,7 @@ static void Postfix() {

PatchBaseClass();
}

static void PatchBaseClass() {
PatchGloryDomain();

Expand Down
8 changes: 4 additions & 4 deletions TabletopTweaks-Base/Bugfixes/Classes/Fighter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void PatchAdvancedWeaponTraining() {
bp.Mode = SelectionMode.Default;
bp.AddFeatures(AdvancedWeapontrainingSelection);
TTTContext.Logger.LogPatch("Patched", bp);
});
});
WeaponTrainingRankUpSelection.TemporaryContext(bp => {
bp.m_AllFeatures = bp.m_AllFeatures.Where(feature => !AdvancedWeapontrainingSelection.m_AllFeatures.Contains(feature)).ToArray();
bp.m_AllFeatures.ForEach(feature => {
Expand All @@ -112,12 +112,12 @@ void PatchAdvancedWeaponTraining() {
});
bp.IgnorePrerequisites = true;
TTTContext.Logger.LogPatch("Patched", WeaponTrainingRankUpSelection);
});
});
SoheiWeaponRankUpTrainingSelection.TemporaryContext(bp => {
bp.IgnorePrerequisites = true;
bp.HideInCharacterSheetAndLevelUp = false;
});
});

AdvancedWeapontrainingSelection.m_AllFeatures.ForEach(feature => {
feature.Get().RemoveComponents<PrerequisiteClassLevel>();
TTTContext.Logger.LogPatch("Patched", feature.Get());
Expand Down
1 change: 0 additions & 1 deletion TabletopTweaks-Base/Bugfixes/Classes/Rogue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using Kingmaker.Blueprints.Classes.Prerequisites;
using Kingmaker.Blueprints.Classes.Selection;
using Kingmaker.Blueprints.JsonSystem;
using Kingmaker.Designers.Mechanics.Facts;
using Kingmaker.EntitySystem.Stats;
using Kingmaker.UnitLogic.FactLogic;
using Kingmaker.UnitLogic.Mechanics;
Expand Down
2 changes: 1 addition & 1 deletion TabletopTweaks-Base/Bugfixes/Classes/Sorcerer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static void PatchAlternateCapstone() {
c.m_Feature = NewContent.AlternateCapstones.Sorcerer.SorcererAlternateCapstone.ToReference<BlueprintFeatureReference>();
});
});

ClassTools.Classes.SorcererClass.TemporaryContext(bp => {
bp.Progression.LevelEntries
.Where(entry => entry.Level == 20)
Expand Down
11 changes: 2 additions & 9 deletions TabletopTweaks-Base/Bugfixes/Classes/WinterWitch.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
using HarmonyLib;
using Kingmaker.Blueprints.Classes;
using Kingmaker.Blueprints.Classes.Prerequisites;
using Kingmaker.Blueprints.Classes.Selection;
using Kingmaker.Blueprints.JsonSystem;
using Kingmaker.Enums;
using Kingmaker.Enums.Damage;
using Kingmaker.RuleSystem.Rules.Damage;
using Kingmaker.UnitLogic.Abilities;
using Kingmaker.UnitLogic.Mechanics.Components;
using TabletopTweaks.Core.Utilities;
using static TabletopTweaks.Base.Main;
using static TabletopTweaks.Core.MechanicsChanges.AdditionalModifierDescriptors;

namespace TabletopTweaks.Base.Bugfixes.Classes {
internal class WinterWitch {
Expand All @@ -28,7 +21,7 @@ static void Postfix() {
[HarmonyPatch(typeof(ChangeSpellElementalDamageHalfUntyped), "OnEventAboutToTrigger", new[] { typeof(RulePrepareDamage) })]
static class ModifierDescriptorHelper_IsStackable_Patch {

static bool Prefix(ChangeSpellElementalDamageHalfUntyped __instance, RulePrepareDamage evt) {
static bool Prefix(ChangeSpellElementalDamageHalfUntyped __instance, RulePrepareDamage evt) {
if (TTTContext.Fixes.WinterWitch.IsDisabled("UnearthlyCold")) { return true; }

AbilityData ability = evt.Reason.Ability;
Expand All @@ -42,7 +35,7 @@ static bool Prefix(ChangeSpellElementalDamageHalfUntyped __instance, RulePrepar
if (energyDamage.EnergyType == __instance.Element && !baseDamage.Precision) {
DirectDamage directDamage = new DirectDamage(baseDamage.Dice.ModifiedValue, 0);
baseDamage.Half.Set(true, __instance.Fact);

directDamage.CopyFrom(baseDamage);
directDamage.SourceFact = __instance.Fact;
evt.Add(directDamage);
Expand Down
2 changes: 1 addition & 1 deletion TabletopTweaks-Base/Bugfixes/Classes/Wizard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static void Postfix() {
Initialized = true;
TTTContext.Logger.LogHeader("Patching Wizard");

}
}
}
}
}
15 changes: 5 additions & 10 deletions TabletopTweaks-Base/Bugfixes/Features/Feats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using Kingmaker.Blueprints.Classes;
using Kingmaker.Blueprints.Classes.Prerequisites;
using Kingmaker.Blueprints.Classes.Selection;
using Kingmaker.Blueprints.Items.Weapons;
using Kingmaker.Blueprints.JsonSystem;
using Kingmaker.Designers.EventConditionActionSystem.Actions;
using Kingmaker.Designers.Mechanics.Facts;
Expand All @@ -15,8 +14,6 @@
using Kingmaker.EntitySystem.Stats;
using Kingmaker.Enums;
using Kingmaker.Enums.Damage;
using Kingmaker.Items;
using Kingmaker.Items.Slots;
using Kingmaker.PubSubSystem;
using Kingmaker.RuleSystem;
using Kingmaker.RuleSystem.Rules;
Expand All @@ -31,7 +28,6 @@
using Kingmaker.UnitLogic.Mechanics.Actions;
using Kingmaker.UnitLogic.Mechanics.Components;
using Kingmaker.UnitLogic.Mechanics.Conditions;
using Kingmaker.UnitLogic.Parts;
using Kingmaker.Utility;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -804,12 +800,11 @@ public void OnEventAboutToTrigger(RuleCalculateWeaponStats evt) {
public void OnEventDidTrigger(RuleCalculateWeaponStats evt) {
DamageDescription damageDescription = evt.DamageDescription.FirstItem();
if (damageDescription != null && damageDescription.TypeDescription.Type == DamageType.Physical) {
if (!evt.DoNotScaleDamage
&& (evt.WeaponDamageDice.HasModifications
|| !evt.Weapon.Blueprint.IsDamageDiceOverridden
|| (evt.Initiator.IsPlayerFaction && !evt.Initiator.Body.IsPolymorphed)
|| evt.IsDefaultUnit))
{
if (!evt.DoNotScaleDamage
&& (evt.WeaponDamageDice.HasModifications
|| !evt.Weapon.Blueprint.IsDamageDiceOverridden
|| (evt.Initiator.IsPlayerFaction && !evt.Initiator.Body.IsPolymorphed)
|| evt.IsDefaultUnit)) {
//DiceFormula diceFormula = WeaponDamageScaleTable.Scale(evt.WeaponDamageDice.ModifiedValue, evt.WeaponSize, Size.Medium, evt.Weapon.Blueprint);
//if (diceFormula != evt.WeaponDamageDice.ModifiedValue) {
// evt.WeaponDamageDice.Modify(diceFormula, ModifierDescriptor.Size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
using Kingmaker.Blueprints.Items.Ecnchantments;
using Kingmaker.Designers;
using Kingmaker.Items;
using System.Linq;
using System;
using System.Linq;

namespace TabletopTweaks.Base.Bugfixes.General {
class ArmorEnhancementBonuses {
[HarmonyPatch(typeof(GameHelper), nameof(GameHelper.GetItemEnhancementBonus), new Type[]{ typeof(ItemEntity) })]
[HarmonyPatch(typeof(GameHelper), nameof(GameHelper.GetItemEnhancementBonus), new Type[] { typeof(ItemEntity) })]
class GameHelper_GetItemEnhancementBonus_Patch {
static void Postfix(ref int __result, ItemEntity item) {
ItemEntityWeapon weapon;
Expand Down
8 changes: 1 addition & 7 deletions TabletopTweaks-Base/Bugfixes/General/VulnerabilityFix.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
using HarmonyLib;
using Kingmaker.EntitySystem.Entities;
using Kingmaker.Enums.Damage;
using Kingmaker.RuleSystem.Rules.Damage;
using Kingmaker.UnitLogic.Abilities.Blueprints;
using Kingmaker.UnitLogic.FactLogic;
using Kingmaker.UnitLogic.Mechanics;
using Kingmaker.Utility;
using Kingmaker.View.MapObjects;
using System;

namespace TabletopTweaks.Base.Bugfixes.General {
Expand All @@ -20,7 +14,7 @@ static void Postfix(AddDamageTypeVulnerability __instance, RuleCalculateDamage e
if (__instance.PhyscicalForm) {
foreach (BaseDamage baseDamage in evt.DamageBundle) {
PhysicalDamage physicalDamage = baseDamage as PhysicalDamage;
if (physicalDamage != null && (physicalDamage.Form & __instance.FormType) > 0) {
if (physicalDamage != null && (physicalDamage.Form & __instance.FormType) > 0) {
physicalDamage.Vulnerability = 1.5f;
}
}
Expand Down
2 changes: 1 addition & 1 deletion TabletopTweaks-Base/Bugfixes/Items/Equipment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void PatchAmuletOfQuickDraw() {
c.RangeType = WeaponRangeType.Ranged;
});
});

TTTContext.Logger.LogPatch(AmuletOfQuickDrawFeature);
}
void PatchAspectOfTheAsp() {
Expand Down
2 changes: 1 addition & 1 deletion TabletopTweaks-Base/Bugfixes/UI/SpellTooltips.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ static void Postfix(TooltipTemplateAbility __instance, ref IEnumerable<ITooltipB
&& __instance.m_AbilityData.Spellbook != null
&& __instance.m_AbilityData.Blueprint.Type == AbilityType.Spell) {
var spellbookName = __instance.m_AbilityData.Spellbook.Blueprint.DisplayName;
var newTypeName = string.IsNullOrEmpty(spellbookName) ? __instance.m_Type : $"{ __instance.m_Type }{ spellbookName }";
var newTypeName = string.IsNullOrEmpty(spellbookName) ? __instance.m_Type : $"{__instance.m_Type}{spellbookName}";
var list = __result.ToList();
if (list.Count > 0) {
list[0] = new TooltipBrickEntityHeader(__instance.m_Name, __instance.m_Icon, newTypeName, __instance.m_School, __instance.m_Level, isItem: false);
Expand Down
1 change: 0 additions & 1 deletion TabletopTweaks-Base/Config/Bugfixes.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Kingmaker.Utility;
using System.Collections.Generic;
using TabletopTweaks.Base.Bugfixes.Classes;
using TabletopTweaks.Core.Config;

namespace TabletopTweaks.Base.Config {
Expand Down
2 changes: 1 addition & 1 deletion TabletopTweaks-Base/MechanicsChanges/MetamagicDamage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static void Postfix(RuleCalculateDamage __instance, ref DamageValue __result, Ba
num3 = damage.PreRolledValue.Value;
} else {
DiceFormula modifiedValue = damage.Dice.ModifiedValue;

if (__instance.RerollAndTakeBest) {
int a = __instance.Roll(modifiedValue, __instance.UnitsCount, damage.CalculationType);
int b = __instance.Roll(modifiedValue, __instance.UnitsCount, damage.CalculationType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public static void UpdateSpells() {
.Where(a => a.AreaEffect.FlattenAllActions()
.OfType<ContextActionDealDamage>()
.Any(a => a.Value.DiceCountValue.ValueType == ContextValueType.Rank))
.Any());
.Any());
if (isIntensifiedSpell) {
if (!spell.AvailableMetamagic.HasMetamagic((Metamagic)CustomMetamagic.Intensified)) {
spell.AvailableMetamagic |= (Metamagic)CustomMetamagic.Intensified;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public static void AddRimeSpell() {
FeatTools.AddAsMetamagicFeat(RimeSpellFeat);
FavoriteMetamagicSelection.AddFeatures(FavoriteMetamagicRime);
}
public static void UpdateSpells() {
public static void UpdateSpells() {
if (TTTContext.AddedContent.Feats.IsDisabled("MetamagicRimeSpell")) { return; }

var spells = SpellTools.GetAllSpells();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Kingmaker.Designers.Mechanics.Facts;
using Kingmaker.UnitLogic.Buffs.Blueprints;
using Kingmaker.UnitLogic.Buffs.Blueprints;
using TabletopTweaks.Core.NewComponents;
using TabletopTweaks.Core.Utilities;
using static TabletopTweaks.Base.Main;
Expand Down
Loading

0 comments on commit 31cf0c2

Please sign in to comment.