Skip to content

[tool] IWD-style Spell Evasion

The user and all related content has been deleted.
«1

Comments

  • [Deleted User][Deleted User] Posts: 0
    edited May 2018
    The user and all related content has been deleted.
    Post edited by [Deleted User] on
  • GwendolyneGwendolyne Member Posts: 461
    edited May 2018
    Tremendous news!

    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. ;)
    Post edited by Gwendolyne on
  • The user and all related content has been deleted.
  • GwendolyneGwendolyne Member Posts: 461
    They are innate abilities (spells) : copper, brass, rust, ruby.... dragon breath (metallic, chromatic, planar... dragons) spells. It might work. :)

  • The user and all related content has been deleted.
  • GwendolyneGwendolyne Member Posts: 461
    That's what I intended to do. ;)

    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.

  • kjeronkjeron Member Posts: 2,368

    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?

    318/324 can block items, 206 cannot.
  • [Deleted User][Deleted User] Posts: 0
    edited May 2018
    The user and all related content has been deleted.
  • GwendolyneGwendolyne Member Posts: 461
    Yeah. That's what I had in mind to avoid giving the thief evade ability to a paladin. :)

    I will code this stuff next week.
  • The user and all related content has been deleted.
  • GrammarsaladGrammarsalad Member Posts: 2,582

    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. :tongue:

    ...okay, this is awesome
  • [Deleted User][Deleted User] Posts: 0
    edited February 2019
    The user and all related content has been deleted.
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    edited February 2019
    ( @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.....
  • [Deleted User][Deleted User] Posts: 0
    edited February 2019
    The user and all related content has been deleted.
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    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.

    Precisely :)
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    edited March 2019
    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?
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    Summoning @kjeron too (as always.....)
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    edited March 2019
    Luke93 wrote: »
    Summoning @kjeron too (as always.....)

    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........
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    edited March 2019
    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......
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    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)
  • kjeronkjeron Member Posts: 2,368
    edited March 2019
    Luke93 wrote: »
    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.
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    kjeron wrote: »
    op318 - 252 !SPLSTATE EFFB
    op318 - 252 !SPLSTATE EFFA

    I cannot see these two....
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    kjeron wrote: »
    op177 - EFFB - op318 252 !SPLSTATE save EFFA
    op177 - EFFA - op324 252 !SPLSTATE nosave SOURCE_RES

    You meant SPLSTATE (without the "!"), right?
  • kjeronkjeron Member Posts: 2,368
    Luke93 wrote: »
    You meant SPLSTATE (without the "!"), right?
    No, it was shorthand for NOT SPLSTATE.
  • The user and all related content has been deleted.
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    edited March 2019
    I'll check that out.....

    Anyway, there should not need for two .EFFs..... I mean, what about this?
    LPF ADD_SPELL_EFFECT
    INT_VAR
    	insert_point = 0
    	opcode = 177			// Use EFF file
    	target = 2
    	parameter2 = 2			// EA = ANYONE
    	duration = 1
    STR_VAR
    	resource = EVAL ~EFF_A~
    END
    
    LPF ADD_SPELL_EFFECT
    INT_VAR
    	insert_point = 0
    	opcode = 318                    // Protection from spell
    	target = 2
    	parameter1 = 252					// EVASION
    	parameter2 = 110                // SPLSTATE = specified value
    	duration = 1
    	savingthrow = BIT1			// Save vs. Breath
    STR_VAR
    	resource = EVAL ~EFF_A~
    END
    
    LPF ADD_SPELL_EFFECT
    INT_VAR
    	insert_point = 0
    	opcode = 318                    // Protection from spell
    	target = 2
    	parameter1 = 26					// ENTANGLE
    	parameter2 = 110                // SPLSTATE = specified value
    	duration = 1
    STR_VAR
    	resource = EVAL ~EFF_A~
    END
    
    LPF ADD_SPELL_EFFECT
    INT_VAR
    	insert_point = 0
    	opcode = 318                    // Protection from spell
    	target = 2
    	parameter1 = 28					// GREASE
    	parameter2 = 110                // SPLSTATE = specified value
    	duration = 1
    STR_VAR
    	resource = EVAL ~EFF_A~
    END
    
    LPF ADD_SPELL_EFFECT
    INT_VAR
    	insert_point = 0
    	opcode = 318                    // Protection from spell
    	target = 2
    	parameter1 = state_helpless_all
    	parameter2 = 138                // STATE bit_eq specified value
    	duration = 1
    STR_VAR
    	resource = EVAL ~EFF_A~
    END
    
    CREATE	"EFF"	"EFF_A"
    	WRITE_LONG 0x010	324		// Immunity from spell and message
    	WRITE_LONG 0x014	2
    	WRITE_LONG 0x01c	252		// EVASION
    	WRITE_LONG 0x020	110		// SPLSTATE = specified value
    	WRITE_LONG 0x028	1		// Duration
    	WRITE_SHORT 0x2c	100		// Probability1
    	WRITE_EVALUATED_ASCII 0x030	~%evaded_spell%~ #8
    	WRITE_LONG 0x090	1		// Resouce type: spell
    	WRITE_EVALUATED_ASCII 0x094	~EFF_A~	#8
    

    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 :( ......
  • kjeronkjeron Member Posts: 2,368
    Luke93 wrote: »
    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:
    1. Min/Max Level/HD
    2. Magic Resistance
    3. Saving Throws (Best->Worst), If Equal:(Death->Wand->Poly->Breath->Spell)
    4. parameters specific to the opcode.
  • The user and all related content has been deleted.
  • kjeronkjeron Member Posts: 2,368
    edited March 2019
    I'm dense about this kind of stuff... what is the consequence of this?
    It just means that second EFF was necessary to avoid the unwanted feedback.
  • The user and all related content has been deleted.
Sign In or Register to comment.