bugfix 21/09/26
This commit is contained in:
parent
834d6647fd
commit
64d8869f98
3 changed files with 70 additions and 3 deletions
|
|
@ -339,9 +339,18 @@ namespace RacesOfValheim
|
|||
if (Player.m_localPlayer == null || Player.m_localPlayer.IsDead()) return;
|
||||
if (isTransformed) return; // Do not cast human spell while in dragon form
|
||||
|
||||
// Hammer, hoe or cultivator in hand: every build button is vanilla's. Middle mouse is
|
||||
// Remove on the keyboard, and on the pad JoySecondaryAttack shares its physical button
|
||||
// with JoyRemove (Classic) or JoyPlace (Alt2) - read off ZInput.AddGamepad*Buttons - so
|
||||
// each piece built or removed also cast the spell and drained the stamina for it.
|
||||
if (Player.m_localPlayer.InPlaceMode()) return;
|
||||
|
||||
// Middle Mouse Button to cast, by default - rebindable via SkadiConfig.ColdSpellKey.
|
||||
// On a gamepad, the secondary attack button (the pad's own middle-mouse equivalent).
|
||||
if (SkadiConfig.ColdSpellKey.Value.IsDownIgnoringHeldKeys() || RaceInput.PadAttackDown(2))
|
||||
// On a gamepad, the secondary attack button (the pad's own middle-mouse equivalent) -
|
||||
// but only bare-handed: the pad has no separate spell key, so with a weapon or a tool
|
||||
// that button belongs to the item's own secondary attack, as it does in vanilla.
|
||||
if (SkadiConfig.ColdSpellKey.Value.IsDownIgnoringHeldKeys() ||
|
||||
(RaceInput.PadAttackDown(2) && PadCastsColdSpell(Player.m_localPlayer)))
|
||||
{
|
||||
// The improved cast is a burst rather than a rapid-fire, so it waits longer.
|
||||
float cooldown = rules.ImprovedColdSpell ? IMPROVED_SPELL_COOLDOWN : SPELL_COOLDOWN;
|
||||
|
|
@ -373,6 +382,19 @@ namespace RacesOfValheim
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the pad's secondary attack button casts the Cold Spell right now: out of build
|
||||
/// mode and with nothing in either hand. Shared with SkadiAttackPatch, which swallows the
|
||||
/// unarmed kick under exactly the same condition.
|
||||
/// </summary>
|
||||
public static bool PadCastsColdSpell(Player player)
|
||||
{
|
||||
if (player == null || player.InPlaceMode()) return false;
|
||||
var hands = HarmonyLib.Traverse.Create(player);
|
||||
return hands.Field<ItemDrop.ItemData>("m_rightItem").Value == null &&
|
||||
hands.Field<ItemDrop.ItemData>("m_leftItem").Value == null;
|
||||
}
|
||||
|
||||
private IEnumerator ColdSpellKickCoroutine(SkadiProgression.FormRules rules)
|
||||
{
|
||||
// Wait for the cast animation to reach the release point
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue