COPY_EXISTING ~SPPR250.spl~ ~override~

  SAY DESC ~Writhing Fog
(Conjuration)

Level: 2
Sphere: Summoning
Range: Visual range of the caster
Duration: 1 turn
Casting Time: 2
Area of Effect: 15-ft. radius
Saving Throw: Special

This spell conjures a cloud of writhing fog that chills and hinders anyone within its area other than the caster.

Creatures in the fog take 1d3 points of cold damage, plus an additional 1d3 every 2 caster levels until 8d3 maximum.

In addition, there is a 20% chance that they must save vs. Death or be slowed for 1 round.

Creatures immune to cold damage do not suffer any adverse effects from this spell.~

  //////////////////////////////////////////////////////////////////////
  // Clone original header 7 times
  //////////////////////////////////////////////////////////////////////

  OUTER_FOR (i = 1; i <= 7; ++i) BEGIN

    LPF CLONE_SPELL_HEADER
      INT_VAR
        header_to_clone = 0
    END

  END

  //////////////////////////////////////////////////////////////////////
  // Patch headers
  //////////////////////////////////////////////////////////////////////

  READ_SHORT 0x64 abil_num
  READ_LONG  0x6a abil_off

  FOR (i = 0; i < abil_num; ++i) BEGIN

    SET level = (i * 2) + 1
    SET dice  = i + 1

    ////////////////////////////////////////////////////////////////////
    // Set minimum caster level
    ////////////////////////////////////////////////////////////////////

    WRITE_SHORT (abil_off + (0x28 * i) + 0x1e) level

    ////////////////////////////////////////////////////////////////////
    // Find effect block
    ////////////////////////////////////////////////////////////////////

    READ_SHORT (abil_off + (0x28 * i) + 0x20) fx_num
    READ_SHORT (abil_off + (0x28 * i) + 0x22) fx_idx

    READ_LONG  0x70 fx_off

    ////////////////////////////////////////////////////////////////////
    // Loop effects in header
    ////////////////////////////////////////////////////////////////////

    FOR (j = 0; j < fx_num; ++j) BEGIN

      SET this_fx = fx_off + ((fx_idx + j) * 0x30)

      READ_SHORT this_fx opcode

      PATCH_IF (opcode = 12) BEGIN

        ////////////////////////////////////////////////////////////////
        // Damage opcode found
        ////////////////////////////////////////////////////////////////

        WRITE_SHORT (this_fx + 0x1c) dice // dice thrown
        WRITE_SHORT (this_fx + 0x20) 3    // dice sides

      END

    END

  END

BUT_ONLY_IF_IT_CHANGES

ACTION_IF FILE_EXISTS_IN_GAME ~SPPR720.spl~ BEGIN

COPY_EXISTING ~SPPR720.spl~ ~override~
  SAY DESC ~Earthquake
(Alteration)

Level: 7
Sphere: Elemental (Earth)
Range: 360 ft.
Duration: 3 tremors
Casting Time: 9
Area of Effect: 15-ft. radius
Saving Throw: Special

When this spell is cast, a local tremor of fairly high strength rips the ground. The shock is over in several rounds. The earthquake affects all creatures in its area of effect. There are 3 tremors that are caused by the earthquake: 

 1st: All creatures affected take 8d8 points of damage and fall to the ground for 4 rounds. A successful Saving Throw vs. Spell with a -6 penalty halves the damage and negates the fall.
 2nd: All creatures affected take 8d8 points of damage. A successful Saving Throw vs. Spell with a -2 penalty halves the damage.
 3rd: All creatures affected take 8d8 points of damage. A successful Saving Throw vs. Spell halves the damage.

This spell will affect both enemies and friends of the caster's, so care must be taken in its use. Finally, earth elementals dislike mere mortals toying with the land and there is a small chance that casting this spell will cause an earth elemental to appear and attack the party.~

  READ_LONG  0x70 fx_off
  READ_SHORT 0x72 fx_num

  FOR (i = 0; i < fx_num; ++i) BEGIN

    SET this_fx = fx_off + (0x30 * i)

    READ_SHORT this_fx opcode

    PATCH_IF (opcode = 12) BEGIN

      ////////////////////////////////////////////////////////////////
      // Set damage to 8d8
      ////////////////////////////////////////////////////////////////

      WRITE_SHORT (this_fx + 0x1c) 8 // dice thrown
      WRITE_SHORT (this_fx + 0x20) 8 // dice sides

    END

  END

BUT_ONLY_IF_IT_CHANGES

END

ACTION_IF FILE_EXISTS_IN_GAME ~SPPR704.spl~ BEGIN

COPY_EXISTING ~SPPR704.spl~ ~override~

  PATCH_IF (SOURCE_SIZE > 0x71) BEGIN

    SAY DESC ~Blablabla~

    // =========================
    // LEVEL 17 VERSION
    // =========================

    LPF CLONE_SPELL_HEADER INT_VAR
      header = 0
    END

    LPF ALTER_SPELL_HEADER INT_VAR
      header = 1
      min_level = 17
    END

    LPF ALTER_EFFECT INT_VAR
      header = 1
      match_opcode = 55
      savebonus = 1
    END


    // =========================
    // LEVEL 20 VERSION
    // =========================

    LPF CLONE_SPELL_HEADER INT_VAR
      header = 1
    END

    LPF ALTER_SPELL_HEADER INT_VAR
      header = 2
      min_level = 20
    END

    LPF ALTER_EFFECT INT_VAR
      header = 2
      match_opcode = 55
      savebonus = -1
    END

  END
BUT_ONLY_IF_IT_CHANGES

END

ACTION_IF FILE_EXISTS_IN_GAME ~SPPR704.spl~ BEGIN
COPY_EXISTING ~SPPR704.spl~ ~override~
  SAY DESC ~Blablabla~
  PATCH_IF (SOURCE_SIZE > 0x71) BEGIN
    LPF ADD_SPELL_HEADER INT_VAR header = 2 ability = 1 ability_type = 1 ability_location = 2 icon = SPPR704B target = 5 range = 1 minimum_level = 17 casting_speed = 6 dicesize = 6 dicenumber = 1   projectile = INAREANP END
    LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 139 target = 2 timing = 1 parameter1 = RESOLVE_STR_REF (~Blinded~) resist_dispel = 3 END 
    LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 55 target = 2 power = 7 parameter1 = 1 parameter2 = 3 timing = 1 resist_dispel = 1 savebonus = 1 savingthrow = 0 END
    LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 74 target = 2 power = 7 timing = 1 resist_dispel = 1 END
    LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 215 target = 1 power = 7 parameter1 = 1 timing = 0 resist_dispel = 1 duration = 2 resource = ICCLKFR2 END
    LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 141 target = 2 power = 7 parameter1 = 0 parameter2 = 18 timing = 1 resist_dispel = 1 END
    LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 142 target = 2 power = 7 parameter2 = 8 timing = 1 resist_dispel = 1 END
    LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 174 target = 2 power = 7 timing = 1 resist_dispel = 1 resource = EFF_P71B END
    LPF ADD_SPELL_HEADER INT_VAR header = 3 ability = 2 ability_type = 1 ability_location = 2 icon = SPPR704B target = 5 Range = 1 minimum_level = 20 casting_speed = 6 dice_size = 6 damage_type = 1  when_drained = 1 projectile = INAREANP END
    LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 139 target = 2 timing = 1 parameter1 = RESOLVE_STR_REF (~Blinded~) resist_dispel = 3 END 
    LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 55 target = 2 power = 7 parameter1 = 1 parameter2 = 3 timing = 1 resist_dispel = 1 savebonus = -1 savingthrow = 0 END
    LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 74 target = 2 power = 7 timing = 1 resist_dispel = 1 END
    LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 215 target = 1 power = 7 parameter1 = 1 timing = 0 resist_dispel = 1 duration = 2 resource = ICCLKFR2 END
    LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 141 target = 2 power = 7 parameter1 = 0 parameter2 = 18 timing = 1 resist_dispel = 1 END
    LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 142 target = 2 power = 7 parameter2 = 8 timing = 1 resist_dispel = 1 END
    LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 174 target = 2 power = 7 timing = 1 resist_dispel = 1 resource = EFF_P71B END
  END

eller

ACTION_IF FILE_EXISTS_IN_GAME ~SPPR704.spl~ BEGIN
COPY_EXISTING ~SPPR704.spl~ ~override~
  SAY DESC ~Blablabla~
  PATCH_IF (SOURCE_SIZE > 0x71) BEGIN
LPF CLONE_SPELL_HEADER INT_VAR header = 1 END
LPF ALTER_SPELL_HEADER INT_VAR header = 2 level = 17 END
LPF ALTER_SPELL_EFFECT INT_VAR ability = 2 match_opcode = 55 save = 1 END // save eller savebonus? saving eller savingthrow?
LPF CLONE_SPELL_HEADER INT_VAR header = 2 END
LPF ALTER_SPELL_HEADER INT_VAR minlevel = 20 END
LPF ALTER_SPELL_EFFECT INT_VAR ability = 3 match_opcode = 55 save = -1 END
  END

LPF ALTER_EFFECT INT_VAR
  header = 1
  match_opcode = 272
STR_VAR
  match_resource = ~GEDAM01.EFF~
  resource = ~GEDAM1.EFF~
END

 