<?php



class param{                


public function crit($info){
$shanse  = mt_rand(1,100);


        return ($shanse <= $info ? true : false); 

  }


public function sokru(){


$vens  = mt_rand(1,100);


        return ($vens <= 30 ? true : false); }



public function udar($sila, $brony,$crit,$sok,$up)



    { 


if($sok==1){ $takt= $sila * $up / 100; $takt = ceil($takt); $sila = $sila +$takt;}





if($crit == 1){ $sila = $sila  * 7.5; $sila = ceil($sila); }












$sila=$sila-$brony;


$total = ($sila <=0 ? mt_rand(1,2) : $sila);








return $total;

}

public function vampir(){


$vensa  = mt_rand(1,100);


        return ($vensa <= 20 ? true : false); }








public function pet(){


$vensi  = mt_rand(1,100);


        return ($vensi <= 30 ? true : false); }



public function hill($sila, $myhp,$max,$vampir,$pet) {


$rand_vamp = mt_rand(1,100);
$rand_pet = mt_rand(1,100);

$hill = $sila * $vampir / 100; $hill = ceil($hill);


$hill = ($rand_vamp<=20) ? $hill : 0;








$last_pet = ($rand_pet<=25) ? $pet : 0;



$conf=$hill+$last_pet;



$conf=$conf+$myhp; 


$itog = ($conf>=$max) ? $max : $conf;



return array ($itog,$hill,$last_pet,$rand_pet,$rand_vamp);




}
}
