some quick findings with interrupt code...
PostPosted: Tue May 23, 2017 12:40 am
firstly, this could all be bullsh*t , as i've been known to post stuff that I very quickly test...
anyway, I took a look at interrupt code as I was trying to improve my caster brain.
first thing i saw was this method thats is only called within SpellHandler by CasterIsAttacked
So I put an override in GamePlayer, creating some calculation and tested again. Level 1 player was still interrupting level 50.
Which brought me to this method
I could time my key press on the spell every second or so and I constantly had a 2 second interrupt timer. If i spammed the spell I could sneak a spell in, but i think this method gets called a few times during a spell cast (could be wrong)
anyway I rearranged this a little bit and it seemed to work ok (super quick test with my new override logic in Gameplayer)

anyway, I took a look at interrupt code as I was trying to improve my caster brain.
first thing i saw was this method thats is only called within SpellHandler by CasterIsAttacked
- Code: Select all
public virtual bool ChanceSpellInterrupt(GameLiving attacker) { double mod = GetConLevel(attacker); double chance = BaseInterruptChance; chance += mod * 10; chance = Math.Max(1, chance); chance = Math.Min(99, chance); if (attacker is GamePlayer) chance = 99; return Util.Chance((int)chance); }
So I put an override in GamePlayer, creating some calculation and tested again. Level 1 player was still interrupting level 50.
Which brought me to this method
- Code: Select all
public virtual void StartInterruptTimer(int duration, AttackData.eAttackType attackType, GameLiving attacker) { if (!IsAlive || ObjectState != eObjectState.Active) { InterruptTime = 0; InterruptAction = 0; return; } if (InterruptTime < CurrentRegion.Time + duration) InterruptTime = CurrentRegion.Time + duration; if (CurrentSpellHandler != null) CurrentSpellHandler.CasterIsAttacked(attacker); if (AttackState && ActiveWeaponSlot == eActiveWeaponSlot.Distance) OnInterruptTick(attacker, attackType); }
I could time my key press on the spell every second or so and I constantly had a 2 second interrupt timer. If i spammed the spell I could sneak a spell in, but i think this method gets called a few times during a spell cast (could be wrong)
anyway I rearranged this a little bit and it seemed to work ok (super quick test with my new override logic in Gameplayer)
- Code: Select all
public virtual void StartInterruptTimer(int duration, AttackData.eAttackType attackType, GameLiving attacker) { if (!IsAlive || ObjectState != eObjectState.Active) { InterruptTime = 0; InterruptAction = 0; return; } if (CurrentSpellHandler != null && CurrentSpellHandler.CasterIsAttacked(attacker)) { InterruptTime = CurrentRegion.Time + duration; return; } if (ChanceSpellInterrupt(attacker)) InterruptTime = CurrentRegion.Time + duration; if (AttackState && ActiveWeaponSlot == eActiveWeaponSlot.Distance) OnInterruptTick(attacker, attackType); }