Location: PHPKode > projects > PhpBlock > A9.8/modules/dungeon/weapontrap.class.php
<?php
include_once $PATH_TO_CODE."/script/weapon.class.php";

class WeaponTrap extends Weapon
{
    public function __construct($parRealObject, $parWeaponNum, $parTargetId, $parAimPercentStartFire, $parAccurency, $parRange, $parDamage)
    {
        parent::__construct($parRealObject, $parWeaponNum, $parTargetId, $parAimPercentStartFire, $parAccurency, $parRange, $parDamage);
    }

    public function doAttackCurrentTarget()
    {
        $locTarget=$this->getCurrentTarget();
        $locTrapIsAgainAlive=true;
        switch(rand(1, 10)) {
            case 1:
            case 2:
                //Dead
                $locTrapIsAgainAlive=false;
            break;
            case 3:
            case 4:
                //alive
                $locTrapIsAgainAlive=true;
            break;
            case 5:
                //dead and strike
                $locTrapIsAgainAlive=false;
            default:
                //strike and alive if target is not alive
                parent::doAttackCurrentTarget();
                if($locTrapIsAgainAlive) {
                    $locTrapIsAgainAlive=!$locTarget->isAlive();
                }
        }
        if(!$locTrapIsAgainAlive) {
            $this->realObject->kill($locTarget);
        }
    }
}
?>
Return current item: PhpBlock