Index: scripts/globals/magic.lua =================================================================== --- scripts/globals/magic.lua (revision 1661) +++ scripts/globals/magic.lua (working copy) @@ -504,21 +508,111 @@ return burst, burstBonus; end +-- Used to calculate weather bonus for nukes and cures +function spellDayWeatherBonus(caster, spell) + day = VanadielDayElement(); + -- Currently just returns 0 at all times. Needs to be 1-8 for array functions. + + weather = caster:getWeather(); + ele = spell:getElement(); + waist = caster:getEquipID(10); + + daybuff = { 1, 2, 3, 4, 5, 6, 7, 8 } + dayweak = { 3, 4, 6, 5, 1, 2, 8, 7 } + + weatherbuff = { 4, 8, 6, 10, 12, 14, 16, 18 } + weatherweak = { 6, 10, 14, 12, 4, 8, 18, 16 } + obi = { 15435, 15438, 15440, 15437, 15436, 15439, 15441, 15442 } + + -- weatherbuff[ele] + 1 would be nice, but doesn't appear to work + weather2buff = { 5, 9, 7, 11, 13, 15, 17, 19 } + weather2weak = { 7, 11, 15, 13, 5, 9, 17, 19 } + + -- Return nil element for weathers 1-3, 0 has no entry and is therefore nil. + weatherelement = { nil, nil, nil, 1, 1, 3, 3, 2, 2, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8 } + + -- Set base bonus + env = 1; + + -- Check for Obi matching day + if(waist == obi[day]) then + d = 1; + else + -- Day of the week procs approximately 20% (1 in 5) + d = math.random(1,5); + end + + -- Check for obi matching weather element + if(waist == obi[weatherelement[weather]]) then + --print("Obi active"); + w = 1; + else + -- Weather procs approximately 33% (1 in 3) + w = math.random(1,3); + end + + -- Adjust for day of the week + -- Commented out effects until day or element is returned, otherwise fire = buffed and ice = gimped + if(d == 1) then + if(day == daybuff[ele]) then + env = env + 0.10; + elseif(day == dayweak[ele]) then + env = env - 0.10; + end + end + + -- Adjust for weather + if(w == 1) then + if(weather == weatherbuff[ele]) then + env = env + 0.10; + elseif(weather == weather2buff[ele]) then + env = env + 0.25; + elseif(weather == weatherweak[ele]) then + env = env - 0.10; + elseif(weather == weather2weak[ele]) then + env = env - 0.25; + end + end + + -- Sorcerer's Tonban NQ and HQ add 5% + if((caster:getEquipID(7) == 15120 or caster:getEquipID(7) == 15583) and ele == daybuff[ele]) then + env = env + 0.05; + end + + -- Zodiac Ring adds 3% + if((caster:getEquipID(13) == 15858 or caster:getEquipID(14) == 15858) and ele == daybuff[ele]) then + env = env + 0.03; + end + + -- Cap at 1.35... + if(env > 1.35) then + env = 1.35; + end + + -- ... unless wearing a Twilight Cape + -- There's some debate about caps. 1.35 w/ cape breaking cap is used here. + if(caster:getEquipID(15) == 16259 and (ele == daybuff[ele] or ele == weatherbuff[ele] or ele == weather2buff[ele])) then + env = env + 0.05; + end + + return env; +end; + -- USED FOR DAMAGING MAGICAL SPELLS. Stages 4,5,6,7,8 of Calculating Magic Damage on Wiki function addBonuses(caster, spell, target, dmg) - --TODO: - --Day of the week / Weather bonus mab = (100 + caster:getMod(MOD_MATT)) / (100 + target:getMod(MOD_MDEF)) ; staff = StaffBonus(caster, spell); burst, burstBonus = calculateMagicBurstAndBonus(caster, spell, target); - + if(burst > 1.0) then - spell:setMsg(spell:getMagicBurstMessage()); -- "Magic Burst!" - end + spell:setMsg(spell:getMagicBurstMessage()); -- "Magic Burst!" + end - --printf("bonuses: %f, %f, %f, %f, %f", dmg, burst, burstBonus, mab, staff); + env = spellDayWeatherBonus(caster, spell); - return (dmg * burst * burstBonus * mab * staff); + -- printf("bonuses: %f, %f, %f, %f, %f, %f", dmg, env, burst, burstBonus, mab, staff); + + return (dmg * env * burst * burstBonus * mab * staff); end --------------------------------------------------------------------- Index: scripts/globals/spells/curaga.lua =================================================================== --- scripts/globals/spells/curaga.lua (revision 1661) +++ scripts/globals/spells/curaga.lua (working copy) @@ -44,8 +44,9 @@ --Check for cure potency equipment. potency = curePotency(caster); - day = 1;--spellDayWeatherBonus(caster, spell, false); - --print("Total day/weather bonus:",day); + --Check for day/weather bonuses + day = spellDayWeatherBonus(caster, spell); + -- printf("Total day/weather bonus: %f",day); --Final amount to heal the target with. final = cure * staff * day * (1 + potency) * CURE_POWER; Index: scripts/globals/spells/curaga_ii.lua =================================================================== --- scripts/globals/spells/curaga_ii.lua (revision 1661) +++ scripts/globals/spells/curaga_ii.lua (working copy) @@ -44,8 +44,9 @@ --Check for cure potency equipment. potency = curePotency(caster); - day = 1;--spellDayWeatherBonus(caster, spell, false); - --print("Total day/weather bonus:",day); + --Check for day/weather bonuses + day = spellDayWeatherBonus(caster, spell); + -- printf("Total day/weather bonus: %f",day); --Final amount to heal the target with. final = cure * staff * day * (1 + potency) * CURE_POWER; Index: scripts/globals/spells/curaga_iii.lua =================================================================== --- scripts/globals/spells/curaga_iii.lua (revision 1661) +++ scripts/globals/spells/curaga_iii.lua (working copy) @@ -44,8 +44,9 @@ --Check for cure potency equipment. potency = curePotency(caster); - day = 1;--spellDayWeatherBonus(caster, spell, false); - --print("Total day/weather bonus:",day); + --Check for day/weather bonuses + day = spellDayWeatherBonus(caster, spell); + -- printf("Total day/weather bonus: %f",day); --Final amount to heal the target with. final = cure * staff * day * (1 + potency) * CURE_POWER; Index: scripts/globals/spells/curaga_iv.lua =================================================================== --- scripts/globals/spells/curaga_iv.lua (revision 1661) +++ scripts/globals/spells/curaga_iv.lua (working copy) @@ -42,8 +42,9 @@ --Check for cure potency equipment. potency = curePotency(caster); - day = 1;--spellDayWeatherBonus(caster, spell, false); - --print("Total day/weather bonus:",day); + --Check for day/weather bonuses + day = spellDayWeatherBonus(caster, spell); + -- printf("Total day/weather bonus: %f",day); --Final amount to heal the target with. final = cure * staff * day * (1 + potency) * CURE_POWER; Index: scripts/globals/spells/cure.lua =================================================================== --- scripts/globals/spells/cure.lua (revision 1661) +++ scripts/globals/spells/cure.lua (working copy) @@ -45,8 +45,9 @@ --Check for cure potency equipment. potency = curePotency(caster); - day = 1;--spellDayWeatherBonus(caster, spell, false); - --print("Total day/weather bonus:",day); + --Check for day/weather bonuses + day = spellDayWeatherBonus(caster, spell); + -- printf("Total day/weather bonus: %f",day); --Final amount to heal the target with. final = cure * staff * day * (1 + potency) * CURE_POWER; Index: scripts/globals/spells/cure_ii.lua =================================================================== --- scripts/globals/spells/cure_ii.lua (revision 1661) +++ scripts/globals/spells/cure_ii.lua (working copy) @@ -45,8 +45,9 @@ --Check for cure potency equipment. potency = curePotency(caster); - day = 1;--spellDayWeatherBonus(caster, spell, false); - --print("Total day/weather bonus:",day); + --Check for day/weather bonuses + day = spellDayWeatherBonus(caster, spell); + -- printf("Total day/weather bonus: %f",day); --Final amount to heal the target with. final = cure * staff * day * (1 + potency) * CURE_POWER; Index: scripts/globals/spells/cure_iii.lua =================================================================== --- scripts/globals/spells/cure_iii.lua (revision 1661) +++ scripts/globals/spells/cure_iii.lua (working copy) @@ -45,8 +45,9 @@ --Check for cure potency equipment. potency = curePotency(caster); - day = 1;--spellDayWeatherBonus(caster, spell, false); - --print("Total day/weather bonus:",day); + --Check for day/weather bonuses + day = spellDayWeatherBonus(caster, spell); + -- printf("Total day/weather bonus: %f",day); --Final amount to heal the target with. final = cure * staff * day * (1 + potency) * CURE_POWER; Index: scripts/globals/spells/cure_iv.lua =================================================================== --- scripts/globals/spells/cure_iv.lua (revision 1661) +++ scripts/globals/spells/cure_iv.lua (working copy) @@ -44,8 +44,9 @@ --Check for cure potency equipment. potency = curePotency(caster); - day = 1;--spellDayWeatherBonus(caster, spell, false); - --print("Total day/weather bonus:",day); + --Check for day/weather bonuses + day = spellDayWeatherBonus(caster, spell); + -- printf("Total day/weather bonus: %f",day); --Final amount to heal the target with. final = cure * staff * day * (1 + potency) * CURE_POWER; Index: scripts/globals/spells/cure_v.lua =================================================================== --- scripts/globals/spells/cure_v.lua (revision 1661) +++ scripts/globals/spells/cure_v.lua (working copy) @@ -45,8 +45,9 @@ --Check for cure potency equipment. potency = curePotency(caster); - day = 1;--spellDayWeatherBonus(caster, spell, false); - --print("Total day/weather bonus:",day); + --Check for day/weather bonuses + day = spellDayWeatherBonus(caster, spell); + -- printf("Total day/weather bonus: %f",day); --Final amount to heal the target with. final = cure * staff * day * (1 + potency) * CURE_POWER;