lundi 30 novembre 2020

PHP code is not being executed but is shows no errors [closed]

The rest of the code works fine but this particular area is not being executed. Also, I'm not getting any errors.

/ ---------- DRAGON FORCE ---------
public function dragonF()
{
    echo $this->character1 . "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa uses " . "<br />";
    $this->damage = $this->damage * 2;
}

// ------ GET & SET SPECIAL SKILLS ------

public function getSpecialSkill1($name)
{
    foreach((array) $this->specialSkill1 as $skill1){
        if ($skill1['name'] == 'skilldragonForce' && $skill1['name'] == $name)
        {
            $randomChance = rand(0, 100);
            if ($randomChance <= $skill1['chance'])
            {
                $this->dragonF();
            }
        }
    }
}

public function setSpecialSkill1()
{
    $this->specialSkill1 = array (
        'attack'  => array (
                'name'     => 'skilldragonForce',
                'chance'   => 90
            ),
    );        
}

This is the condition, I've tried to echo something and it works, that's why I think the problem comes from the code above

     if($this->attacker->getType() === 1 && $this->attacker->getDamage())
     {           
         $this->attacker->getSpecialSkill1('skilldragonForce');
     }

Aucun commentaire:

Enregistrer un commentaire