Ejemplo 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
    }
Ejemplo n.º 2
0
    public void setTargetParam(gameChar target, int field, int effectVal)
    {
        switch (field)
        {
        case 0: target.setCurrentHP(target.getCurrentHP() + effectVal); break;

        case 1: target.setCurrentMP(target.getCurrentMP() + effectVal); break;

        case 2: target.setAttMod(target.getAttMod() + effectVal); break;

        case 3: target.setDefMod(target.getDefMod() + effectVal); break;

        case 4: target.setIntMod(target.getIntMod() + effectVal); break;
        }
    }