PHP interesse |
|
<?php
function DPS($weapon,$min,$max)
{
$weapon = strtolower($weapon);
switch($weapon) {
case 'axe': $attackspeed = 1.33;
case 'daggers': $attackspeed = 1.33;
case 'sword': $attackspeed = 1.33;
case 'spear': $attackspeed = 1.50;
case 'hammer': $attackspeed = 1.75;
case 'staff': $attackspeed = 1.75;
case 'wand': $attackspeed = 1.75;
case 'scythe': $attackspeed = 1.75;
case 'shortbow': $attackspeed = 2.00;
case 'flatbow': $attackspeed = 2.00;
case 'longbow': $attackspeed = 2.40;
case 'recurve bow': $attackspeed = 2.40;
case 'hornbow': $attackspeed = 2.70;
}
$averagedmg = (($min+$max)/2)/$attackspeed;
return $averagedmg;
}
echo DPS('Sword',15,22); // hier zou 13.875 uit moeten komen, maar er komt 6.8518518518519 uit.
?>
<?php function DPS($weapon,$min,$max) { switch($weapon) { case 'axe': $attackspeed = 1.33; case 'daggers': $attackspeed = 1.33; case 'sword': $attackspeed = 1.33; case 'spear': $attackspeed = 1.50; case 'hammer': $attackspeed = 1.75; case 'staff': $attackspeed = 1.75; case 'wand': $attackspeed = 1.75; case 'scythe': $attackspeed = 1.75; case 'shortbow': $attackspeed = 2.00; case 'flatbow': $attackspeed = 2.00; case 'longbow': $attackspeed = 2.40; case 'recurve bow': $attackspeed = 2.40; case 'hornbow': $attackspeed = 2.70; } $averagedmg = (($min+$max)/2)/$attackspeed; return $averagedmg; } echo DPS ('Sword',15,22); // hier zou 13.875 uit moeten komen, maar er komt 6.8518518518519 uit. ?>
hier zou 13.875 uit moeten komen, maar er komt 6.8518518518519 uit., waarom?
oja, en link met berekening voor DPS http://wiki.guildwars.com/wiki/Damage_Per_Second
|