Esempio n. 1
0
    public override float cast(gameChar source, gameChar target, int currentRound)
    {
        float effectingVal = 0;
        int   chance       = Random.Range(0, 100);

        if (chance < 40)
        {
            return(0);
        }

        effectingVal = effectVal * (source.getAttVal() + source.getAttMod()) - (target.getDefVal() + target.getDefMod());
        //damage = val * att - def
        if (effectingVal <= 0)
        {
            effectingVal = 1;                           //if no damage, set damage to 1
        }
        effectingVal = -(effectingVal);
        if (Mathf.Abs(effectingVal) >= target.getCurrentHP())
        {
            effectingVal = -(target.getCurrentHP());
        }
        //if damage > current health, set difference = currentHP (currentHP - currentHP = 0)
        setTargetParam(target, 0, (int)(effectingVal));
        return(-(effectingVal));                //effectingVal must be <0 and negate it
    }