inevit4ble
Well-Known Member
- Reaction score
- 38
Ok, This is the "finished" version of the trigger:
1 of the 3 patterns (for Bard) follows a similar pattern as the others but is every 3rd level instead of even or odd.
the other 2, Ranger and Paladin, don't actually follow a pattern. They seem random ... ish. Like there's smaller patterns within the grid but nothing overall so for these 2 I have just set them manually.
I think this will do the job.
Thanks smitty for your input
1 of the 3 patterns (for Bard) follows a similar pattern as the others but is every 3rd level instead of even or odd.
the other 2, Ranger and Paladin, don't actually follow a pattern. They seem random ... ish. Like there's smaller patterns within the grid but nothing overall so for these 2 I have just set them manually.
I think this will do the job.
Thanks smitty for your input
JASS:
//========================================================================
//~~~~~~~~~~~~~~~~~~~~~~ Spells Per Level Per Class ~~~~~~~~~~~~~~~~~~~~~~
//========================================================================
function SpellTable takes unit u returns nothing
// ------------------
// Constants
local integer i = GetHeroLevel(u)
local integer j = -1
local integer k
local boolean even = false
// ------------------
// Changables
local integer min //From where new level amounts start
local integer max //Max number of casts per level
local integer a1
local integer a2
local integer b1
local integer b2
local integer c
local integer d1
local integer d2
local integer skip //Level to skip backward increment
local integer pattern //From where the pattern begins
local boolean run //Whether Increment runs on even or odd
// ------------------
if UD<u>.cla == "Wizard" then
// ------------------
if i == 19 then
set UD<u>.castsMax[7] = 4
set UD<u>.castsMax[9] = 3
return
endif
// ------------------
set max = 4
set min = 1
set a1 = 2
set a2 = 2
set b1 = 2
set b2 = 0
set c = -3
set d1 = 2
set d2 = -1
set run = true
set skip = 5
set pattern = 3
// ------------------
elseif UD<u>.cla == "Sorcerer" then
// ------------------
if i == 19 then
set UD<u>.castsMax[8] = 6
set UD<u>.castsMax[9] = 4
return
endif
// ------------------
set max = 6
set min = 3
set a1 = 3
set a2 = 1
set b1 = 2
set b2 = 1
set c = -1
set d1 = 2
set d2 = 0
set run = false
set skip = 4
set pattern = 4
// ------------------
elseif UD<u>.cla == "Druid" or UD<u>.cla == "Cleric" then
// ------------------
if i == 4 then
set UD<u>.castsMax[0] = 5
endif
if i == 7 then
set UD<u>.castsMax[0] = 6
endif
if i == 19 then
set UD<u>.castsMax[5] = 5
set UD<u>.castsMax[7] = 4
set UD<u>.castsMax[9] = 3
return
endif
if i == 20 then
set UD<u>.castsMax[8] = 4
set UD<u>.castsMax[9] = 4
return
endif
// ------------------
set run = false//New Levels on Odd
set pattern = 3//Starts from Level 3
set max = 6
set min = 1
set a1 = 2
set a2 = 2
set b1 = 2
set b2 = 0
set c = -3
set d1 = 2
set d2 = -1
set skip = 5
// ------------------
elseif UD<u>.cla == "Ranger" or UD<u>.cla == "Paladin" then
// ------------------
if i == 6 then
set UD<u>.castsMax[1] = 1
elseif i == 10 then
set UD<u>.castsMax[2] = 1
elseif i == 12 then
set UD<u>.castsMax[3] = 1
elseif i == 14 then
set UD<u>.castsMax[1] = 2
set UD<u>.castsMax[4] = 0
elseif i == 15 then
set UD<u>.castsMax[4] = 1
elseif i == 16 then
set UD<u>.castsMax[2] = 2
elseif i == 17 then
set UD<u>.castsMax[3] = 2
elseif i == 18 then
set UD<u>.castsMax[1] = 3
elseif i == 19 then
set UD<u>.castsMax[2] = 3
set UD<u>.castsMax[3] = 3
set UD<u>.castsMax[4] = 2
elseif i == 20 then
set UD<u>.castsMax[4] = 3
endif
return
// ------------------
elseif UD<u>.cla == "Bard" then
// ------------------
set max = 4
set min = 1
set pattern = 5
if i < pattern then
if i == 2 then
set UD<u>.castsMax[0] = 3
elseif i == 3 then
set UD<u>.castsMax[1] = 1
elseif i == 4 then
set UD<u>.castsMax[1] = 2
endif
return
endif
if i == 20 then
loop
set j = j + 1
set UD<u>.castsMax[j] = max
exitwhen j == 9
endloop
return
endif
set k = 2
loop
set k = k + 3
if i == k then
set even = true
endif
exitwhen i == k
exitwhen k > i
endloop
set k = 3
loop
set k = k + 3
if i == k then
set run = true
endif
exitwhen i == k
exitwhen k > i
endloop
if run then
//For Increment Levels :
loop
set j = j + 1
if i == (j*3) then
set UD<u>.castsMax[j] = UD<u>.castsMax[j] + 1
endif
exitwhen i == (j*3)
endloop
elseif even then
//For New Levels:
loop
set j = j + 1
if UD<u>.castsMax[j] == 0 then
set UD<u>.castsMax[j] = min
if i != skip then
set k = j - 1
set UD<u>.castsMax[k] = UD<u>.castsMax[k] + 1
if i >= 14 then
set k = i - 14
set UD<u>.castsMax[k] = UD<u>.castsMax[k] + 1
endif
endif
endif
exitwhen i == (j*3)-1
endloop
endif
// ------------------
endif
// ------------------
if i < pattern then
//For Levels before pattern starts:
loop
set j = j + 1
if UD<u>.castsMax[j] != max and UD<u>.castsMax[j] > 0 then
set UD<u>.castsMax[j] = UD<u>.castsMax[j] + 1
endif
exitwhen j == 1
endloop
return
endif
// ------------------
if i == 20 then
loop
set j = j + 1
set UD<u>.castsMax[j] = max
exitwhen j == 9
endloop
return
endif
// ------------------
//Check if level is even or odd
set k = i/2
set k = k * 2
if k == i then
set even = true
endif
// ------------------
if even == run then
//For Increment Levels :
loop
set j = j + 1
if i == (j*a1)+a2 then
set UD<u>.castsMax[j] = UD<u>.castsMax[j] + 1
elseif i == (j*b1)+b2 then
set UD<u>.castsMax[j] = UD<u>.castsMax[j] + 1
endif
exitwhen i == (j*b1)+b2
endloop
else
//For New Levels:
loop
set j = j + 1
if UD<u>.castsMax[j] == 0 then
set UD<u>.castsMax[j] = min
if i != skip then
set k = j + c
set UD<u>.castsMax[k] = UD<u>.castsMax[k] + 1
if UD<u>.cla == "Druid" or UD<u>.cla == "Cleric" then
if i >= 11 then
set k = k - 2
set UD<u>.castsMax[k] = UD<u>.castsMax[k] + 1
endif
endif
endif
endif
exitwhen i == (j*d1)+d2
endloop
endif
// ------------------
endfunction
//========================================================================
//========================================================================
//========================================================================</u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u></u>