It is for a paladin kit, a kind of cavalier only specialized in dragons fighting. I wrote it for the classic games and could not code all the abilities I wanted. At level 10, he chooses a dragon special enemy and gains bonus against them every 5 levels. With your code, I can give him (at level 30) a percentage to avoid their dragon breath.
I haven't tried applying this to item effects. I wonder if @kjeron knows whether 324/318 effects in item abilities will block the ability from taking effect, the way it works in spells?
Worth mentioning: this basic framework could be adapted for use in ways other than the strict IWD-style Evasion ability.
For instance, by adding a bit more to this (adding a new, different spellstate), you could do something like: - give jesters an extra saving throw to evade spells that cause charm and confusion - give all paladins an extra saving throw to evade spells that cause fear - replace the blanket immunities of Berserk Rage with an extra saving throw to evade the effects
...actually, I might just implement that last one myself.
( @Luke93 I think we missed a bit in our recent discussion of the matter - I think all bases are covered now.)
Speaking of this, I guess CD_STATE_NOTVALID may be an appropriate parameter1 for the 2 opcodes #318 (it's a hex sum of bits, each responsible for one of debilitating states. E.g. confusion, feeblemindedness, silence, various deaths etc.).
However, after further reflection, we did miss something: Grease and Entangle.
As far as I know, these two spells don't set any STATE, so we need to patch them by adding opcode #328 (param2 = 28 and 26 respectively). After that, we need to add two more opcodes #318 (param2: splstate = specified value, param1 = 28 and 26 respectively) to every .SPL/ITM that is meant to be evadable.....
In any event what you suggest sounds right to me, you shouldn't be able to evade a Fireball if you're slip-sliding in a pool of grease. EDIT - oh I see, you mean spellstates 26 and 28. Yeah, that's a good idea.
Here we go again: I found another oddity ---> It seems that the string Save vs. Breath Weapons triggers even for characters that do not have the relevant spell state (have a look at the attached screenshot: Holy Smite is not supposed to provide a Save vs. Breath....) Why?
First, this fixes a small bug that was adding unnecessary saving throw feedback for targets who should not be affected by Evasion at all.
Nope, unfortunately .....
As I said, it seems that this type of feedback Abdel: Save vs. Breath Weapon: 16 always triggers (even for all those CREs that don't have the Evasion spell state.....). This is probably linked to op#177 and its check for EA/ANYONE......
As you said, a possible solution would be that of defining the group of people who can evade by being in a certain CLASS..... The problem with this solution is that the Evasion passive ability will be available right from level 1......
Wait, that is easy to fix : just add another two opcodes #318 protecting from the two EFFs if preset target does not have EVASION (parameter1 = 252, parameter2 = SPLSTATE != specified value)
Wait, that is easy to fix : just add another two opcodes #318 protecting from the two EFFs if preset target does not have EVASION (parameter1 = 252, parameter2 = SPLSTATE != specified value)
That's what it already does...
op318 - helpless STATEs EFFB
op318 - helpless STATEs EFFA
op318 - 252 !SPLSTATE EFFB
op318 - 252 !SPLSTATE EFFA
op177 - EFFB - op318 252 !SPLSTATE save EFFA
op177 - EFFA - op324 252 !SPLSTATE nosave SOURCE_RES
I don't know what circumstances are causing it to not do that for you.
The problem is that for some bizarre reason (a bug probably), the saving throw feedback triggers even if the targeted CRE doesn't meet the conditions specified by opcode #318/324 ......
The problem is that for some bizarre reason (a bug probably), the saving throw feedback triggers even if the targeted CRE doesn't meet the conditions specified by opcode #318/324 ......
It's standard check order:
Min/Max Level/HD
Magic Resistance
Saving Throws (Best->Worst), If Equal:(Death->Wand->Poly->Breath->Spell)
Comments
My todo list contains the line 'escape dragon breaths'. It would be awesome if your code spared me hours of coding. I will try it out.
It is for a paladin kit, a kind of cavalier only specialized in dragons fighting. I wrote it for the classic games and could not code all the abilities I wanted. At level 10, he chooses a dragon special enemy and gains bonus against them every 5 levels. With your code, I can give him (at level 30) a percentage to avoid their dragon breath.
thanks again.
I will code this stuff next week.
Speaking of this, I guess CD_STATE_NOTVALID may be an appropriate parameter1 for the 2 opcodes #318 (it's a hex sum of bits, each responsible for one of debilitating states. E.g. confusion, feeblemindedness, silence, various deaths etc.).
However, after further reflection, we did miss something: Grease and Entangle.
As far as I know, these two spells don't set any STATE, so we need to patch them by adding opcode #328 (param2 = 28 and 26 respectively). After that, we need to add two more opcodes #318 (param2: splstate = specified value, param1 = 28 and 26 respectively) to every .SPL/ITM that is meant to be evadable.....
Precisely
I suspect this has something to do with opcode #177 and its check for EA/ANYONE..... Everything is fine if you check for CLASS/THIEF_ALL........
Nope, unfortunately
As I said, it seems that this type of feedback Abdel: Save vs. Breath Weapon: 16 always triggers (even for all those CREs that don't have the Evasion spell state.....). This is probably linked to op#177 and its check for EA/ANYONE......
As you said, a possible solution would be that of defining the group of people who can evade by being in a certain CLASS..... The problem with this solution is that the Evasion passive ability will be available right from level 1......
op318 - helpless STATEs EFFB
op318 - helpless STATEs EFFA
op318 - 252 !SPLSTATE EFFB
op318 - 252 !SPLSTATE EFFA
op177 - EFFB - op318 252 !SPLSTATE save EFFA
op177 - EFFA - op324 252 !SPLSTATE nosave SOURCE_RES
I don't know what circumstances are causing it to not do that for you.
I cannot see these two....
You meant SPLSTATE (without the "!"), right?
Anyway, there should not need for two .EFFs..... I mean, what about this?
The problem is that for some bizarre reason (a bug probably), the saving throw feedback triggers even if the targeted CRE doesn't meet the conditions specified by opcode #318/324