$DmgLv[lv, min/max] var $DmgLvMax; // array, calculating dmg per level 1 to 20 -> $DmgLv[lv, min/max] var $SP; // Spellpoints base cost var $Type; // see callDmgType var $SpellLv; // level of the spell var $maxCLevel = 16; // maximum caster level avail // customization var $SDA; // set caster level for SDA, -1 = auto var $SCA; // set caster level for SCA, -1 = auto var $DItem; // damage modifier item name var $DBonus; // damage modifier item score var $CItem; // critical modifier item name var $CBonus; // critical modifier item score // internal vars var $SPMaximize = 25; // add Spellpoints for maximize active var $SPEmpower = 15; // add Spellpoints for empower active /* Miscellaneous: 0 Slash: 1 Blunt: 2 Pierce: 3 Acid: 4 Chaos: 5 Cold: 6 Divine: 7 Electricity: 8 Evil: 9 Fire: A Force: B Good: C Law: D Light: E Negative: F Positive: G Repair: H Sonic: I */ var $DmgTypeTxt = array("Miscellaneous", "Slash", "Blunt ", "Pierce", "Acid", "Chaos", "Cold", "Divine", "Electricity", "Evil", "Fire", "Force", "Good", "Law", "Light", "Negative", "Positive", "Repair", "Sonic"); // output strings var $outTBLinit = "\n"; var $outTBLhead = "\n\n\n\n\n\n\n\n\n\n"; var $out2f2f2f = "\n"; var $outddd = "\n"; var $outd2f = "\n"; var $outDAI = " Damage Amplifier Item"; var $outDCI = " Critical Amplifier Item"; var $outSDA = " + %.2f SDA"; var $outSCA = " + %.2f SCA"; var $outSDAauto = " + max SDA avail to Level"; var $outSCAauto = " + max SCA avail to Level"; var $outLv = "\n\n"; function customize($a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9, $a10, $a11, $a12) {// to overload output strings for language or design $this->out2f2f2f = $a1; $this->outddd = $a2; $this->outd2f = $a3; $this->outDAI = $a4; $this->outDCI = $a5; $this->outSDA = $a6; $this->outSCA = $a7; $this->outSDAauto = $a8; $this->outSCAauto = $a9; $this->outLv = $a10; $this->outTBLinit = $a11; $this->outTBLhead = $a12; } function callDmgTyp() { /* Miscellaneous: 0 Slash: 1 Blunt: 2 Pierce: 3 Acid: 4 Chaos: 5 Cold: 6 Divine: 7 Electricity: 8 Evil: 9 Fire: A Force: B Good: C Law: D Light: E Negative: F Positive: G Repair: H Sonic: I */ $tmpDMG = trim($this->Type); $tmpOUT = ""; for ($i=0; $i < strlen($tmpDMG); $i++) { $tmp = substr($tmpDMG, $i, 1); if ($tmp >= "0" and $tmp <= "9") { $tmp = ((ord($tmp)) - 48); } else { $tmp = ((ord(ucfirst($tmp))) - 55); } if ($i == 0) { $tmpOUT = $this->DmgTypeTxt[$tmp]; } else { $tmpOUT = $tmpOUT . " / " . $this->DmgTypeTxt[$tmp]; } } return $tmpOUT; } function callSpellHeader() { print "Spell: " . $this->Spell . "
\n Damage Type: " . $this->callDmgTyp() . "
\n"; } function calSPMaxi($tmpSP) { $spmax = $this->SPMaximize + $tmpSP; return $spmax; } function calSPEmp($tmpSP) { $spemp = $this->SPEmpower + $tmpSP; return $spemp; } function calAvg($tmpL, $tmpH) { return (($tmpL + $tmpH) / 2); } function calAmp($lv, $score) { /* spell damage amplification: I: Lv1: 10% II: Lv4: 20% III: Lv7: 30% IV: Lv10: 40% */ if ($this->SDA == -1) { if ($lv > 9) { $factor = 1.4; } else { if ($lv > 6) { $factor = 1.3; } else { if ($lv > 3) { $factor = 1.2; } else { $factor = 1.1; } } } } else { $factor = $this->SDA; } if ($this->DBonus > 0) { $factor = $factor + $this->DBonus; if ($factor >= 2) { $factor = $factor - 1; } } $score = $score * $factor; return $score; } function calCrit($lv) { /* spell chritical multiplier: O: Lv1 : 1.5 I: Lv5: 1.75 II: Lv9: 2.00 III: Lv13: 2.25 */ if ($this->SCA == -1) { if ($lv > 12) { $factor = 2.25; } else { if ($lv > 8) { $factor = 2.0; } else { if ($lv > 4) { $factor = 1.75; } else { $factor = 1.5; } } } } else { $factor = 1.5 + $this->SCA; } $factor = $factor + $this->CBonus; return $factor; } function outbonus() { if ($this->SDA != 1) { if ($this->SDA == -1) { echo $this->outSDAauto; } else { printf($this->outSDA, $this->SDA); } } if ($this->SCA != 0) { if ($this->SCA == -1) { echo $this->outSCAauto; } else { printf($this->outSCA, $this->SCA); } } if (strlen($this->DItem) > 0) { echo " + " . $this->DItem . $this->outDAI; } if (strlen($this->CItem) > 0) { echo " + " . $this->CItem . $this->outDCI; } } function calCLv() {// calculating the caster level $tmp = ((2 * $this->SpellLv) - 1); return $tmp; } function call($bdice, $sdice, $mdice, $updice, $bdmg, $type, $name, $spellpoints, $spelllevel) { $lv = 1; // basic start level $counter = 1; // counter for uplevel / damage $tmp = 1; // counter for bonus dmg / level $this->BDice = $bdice; $this->SDice = $sdice; $this->MDice = $mdice; $this->UpDice = $updice; $this->BDmg = $bdmg; $this->Type = $type; $this->Spell = $name; $this->SP = $spellpoints; $this->SpellLv = $spelllevel; //$counter = $this->calCLv(); for ($lv = 1; $lv <= 20; $lv++) { if ($lv >= ($counter + $updice)) { if ($tmp < $mdice) { $counter = $lv; $tmp++; //= $tmp + $sdice; } } $this->DmgLvMin[$lv] = $tmp * $bdmg + $tmp * $sdice; $this->DmgLvMax[$lv] = $tmp * $bdmg + $tmp * $bdice * $sdice; } } function setbonus($sda, $sca, $ditem, $dbonus, $citem, $cbonus, $maxLv = 16) { $this->SDA = $sda; $this->SCA = $sca; $this->DItem = $ditem; $this->DBonus = $dbonus; $this->CItem = $citem; $this->CBonus = $cbonus; $this->maxCLevel = $maxLv; } function avgsp() { $lv = 1; // level for damage $crit = 1.5; // critical dmg multiplicator $tmpOut = $this->outd2f; $this->callSpellHeader(); $this->outbonus(); // calculate dmg table echo "
Caster LevelAmplificationCriticalmaximisemax/critempoweremp/critmax/empmax/emp/crit
%.2f ~ %.2f (%.2f)%d ~ %d (%d)%d / %.2f
%d
\n"; echo $this->outTBLhead; $tmp = $this->calCLv(); for ($lv = $tmp; $lv <= $this->maxCLevel; $lv++) { $low = $this->DmgLvMin[$lv]; $high = $this->DmgLvMax[$lv]; $sp = $this->SP; // level echo "\n\n"; // ampli $low = $this->calAmp($lv, $low); $high = $this->calAmp($lv, $high); $tmpAvg = $this->calAvg($high, $low); printf($tmpOut, $tmpAvg, $tmpAvg / $sp); $crit = $this->calCrit($lv); printf($tmpOut, $tmpAvg * $crit, $tmpAvg * $crit / $sp); // maxi x2 $tmpsp = $this->calSPMaxi($sp); printf($tmpOut, $tmpAvg * 2, $tmpAvg * 2 / $sp); // maxi x2 + crit printf($tmpOut, $tmpAvg * 2 * $crit, $tmpAvg * 2 * $crit / $sp); // empow x1.5 $tmpsp = $this->calSPEmp($sp); printf($tmpOut, $tmpAvg * 1.5, $tmpAvg * 1.5 / $sp); // empow x1.5 + crit printf($tmpOut, $tmpAvg * 1.5 * $crit, $tmpAvg * 1.5 * $crit / $sp); // max / emp ~ x2.5 $tmpsp = $this->calSPMaxi ($sp) + $this->calSPEmp ($sp); printf($tmpOut, $tmpAvg * 2.5, $tmpAvg * 2.5 / $sp); // max / emp ~ 2.5 + crit printf($tmpOut, $tmpAvg * 2.5 * $crit, $tmpAvg * 2.5 * $crit / $sp); echo "\n"; } echo "
" . $lv . "
\n
Powered by Warbread.net"; } function dps() { $lv = 1; // level for damage $crit = 1.5; // critical dmg multiplicator $tmpOut = $this->out2f2f2f; $this->callSpellHeader(); $this->outbonus(); // calculate dmg table echo "\n"; echo $this->outTBLhead; $tmp = $this->calCLv(); for ($lv = $tmp; $lv <= $this->maxCLevel; $lv++) { $low = $this->DmgLvMin[$lv]; $high = $this->DmgLvMax[$lv]; $sp = $this->SP; // level echo "\n\n"; // ampli $low = $this->calAmp($lv, $low); $high = $this->calAmp($lv, $high); $tmpAvg = $this->calAvg($high, $low); printf($tmpOut, $low / $sp, $high / $sp, $tmpAvg / $sp); $crit = $this->calCrit($lv); printf($tmpOut, ($low * $crit) / $sp, ($high * $crit) / $sp, $crit * $tmpAvg / $sp); // maxi x2 $tmpsp = $this->calSPMaxi($sp); printf($tmpOut, $low * 2 / $tmpsp , $high * 2 / $tmpsp, 2 * $tmpAvg / $tmpsp); // maxi x2 + crit printf($tmpOut, ($low * 2 * $crit) / $tmpsp, ($high * 2 * $crit) / $tmpsp, 2 * $crit * $tmpAvg / $tmpsp); // empow x1.5 $tmpsp = $this->calSPEmp($sp); printf($tmpOut, $low * 1.5 / $tmpsp, $high * 1.5 / $tmpsp, 1.5 * $tmpAvg / $tmpsp); // empow x1.5 + crit printf($tmpOut, ($low * 1.5 * $crit) / $tmpsp, ($high * 1.5 * $crit) / $tmpsp, 1.5 * $crit * $tmpAvg / $tmpsp); // max / emp ~ x2.5 $tmpsp = $this->calSPMaxi ($sp) + $this->calSPEmp ($sp); printf($tmpOut, $low * 2.5 / $tmpsp, $high * 2.5 / $tmpsp, 2.5 * $tmpAvg / $tmpsp); // max / emp ~ 2.5 + crit printf($tmpOut, ($low * 2.5 * $crit) / $tmpsp, ($high * 2.5 * $crit) / $tmpsp, 2.5 * $crit * $tmpAvg / $tmpsp); echo "\n"; } echo "
" . $lv . "
\n
Powered by Warbread.net"; } function base() { $lv = 1; // level for damage $crit = 1.5; // critical dmg multiplicator $tmpOut = $this->outddd; $this->callSpellHeader(); $this->outbonus(); // calculate dmg table echo "\n"; echo $this->outTBLhead; $tmp = $this->calCLv(); for ($lv = $tmp; $lv <= $this->maxCLevel; $lv++) { $low = $this->DmgLvMin[$lv]; $high = $this->DmgLvMax[$lv]; // level echo "\n\n"; // ampli $low = $this->calAmp($lv, $low); $high = $this->calAmp($lv, $high); $tmpAvg = $this->calAvg($high, $low); printf($tmpOut, $low, $high, $tmpAvg); $crit = $this->calCrit($lv); printf($tmpOut, $low * $crit, $high * $crit, $tmpAvg * $crit); // maxi x2 printf($tmpOut, $low * 2, $high * 2, 2 * $tmpAvg); // maxi x2 + crit printf($tmpOut, $low * 2 * $crit, $high * 2 * $crit, 2 * $crit * $tmpAvg); // empow x1.5 printf($tmpOut, $low * 1.5, $high * 1.5, 1.5 * $tmpAvg); // empow x1.5 + crit printf($tmpOut, $low * 1.5 * $crit, $high * 1.5 * $crit, 1.5 * $crit * $tmpAvg); // max / emp ~ x2.5 printf($tmpOut, $low * 2.5, $high * 2.5, 2.5 * $tmpAvg); // max / emp ~ 2.5 + crit printf($tmpOut, $low * 2.5 * $crit, $high * 2.5 * $crit, 2.5 * $crit * $tmpAvg); echo "\n"; } echo "
" . $lv . "
\n
Powered by Warbread.net"; } } ?>