Пример #1
0
    public override float cast(gameChar source, gameChar target, int currentRound)
    {
        float sourceMP = source.getCurrentMP();

        if (sourceMP < cost)
        {
            return(-1);
        }
        source.setCurrentMP(sourceMP - cost);

        float effectingVal = 0;
        float magicDef     = target.getIntVal() + target.getIntMod();

        effectingVal = effectVal * (source.getIntVal() + source.getIntMod()) * 1 + magicDef;
        //value = -(spellAmount * intelligence * amplifier - targetIntelligence)
        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)
        base.setTargetParam(target, 0, (int)(effectingVal));
        return(-(effectingVal));                //effectingVal must be <0 and negate it
    }
Пример #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;
        }
    }
Пример #3
0
    public override float cast(gameChar source, gameChar target, int currentRound)
    {
        float sourceMP = source.getCurrentMP();

        if (sourceMP < cost)
        {
            return(-1);
        }
        source.setCurrentMP(sourceMP - cost);

        float effectingVal = 0;

        effectingVal = effectVal * source.getIntVal() * 0.1f;
        target.decreaseAttr(field, effectingVal, currentRound);
        return(effectingVal);
    }
Пример #4
0
    public bool unEquipChar(gameChar equiped)
    {
        for (int i = 0; i < rank; i++)                  //for each rank, unset owner's attribute
        {
            float effectingVal = attributePair[i].second;
            switch ((int)(attributePair[i].first))
            {
            case 0: {
                equiped.setMaxHP(equiped.getMaxHP() - effectingVal);
                equiped.setCurrentHP(equiped.getCurrentHP() - effectingVal);
                break;
            }

            case 1: {
                equiped.setMaxMP(equiped.getMaxMP() - effectingVal);
                equiped.setCurrentMP(equiped.getCurrentMP() - effectingVal);
                break;
            }

            case 2: {
                equiped.setAttack(equiped.getAttack() - effectingVal);
                break;
            }

            case 3: {
                equiped.setDefense(equiped.getDefense() - effectingVal);
                break;
            }

            case 4: {
                equiped.setIntelligence(equiped.getIntelligence() - effectingVal);
                break;
            }

            default: {
                return(false);

                break;
            }
            }
        }
        return(true);
    }
Пример #5
0
    public override float cast(gameChar source, gameChar target, int currentRound)
    {
        float sourceMP = source.getCurrentMP();

        if (sourceMP < cost)
        {
            return(-1);
        }
        source.setCurrentMP(sourceMP - cost);

        float effectingVal = 0;

        effectingVal = effectVal * (source.getIntVal() + source.getIntMod()) * 1;
        //value = spellAmount * intelligence * amplifier
        if ((target.getCurrentHP() + effectingVal) >= target.getMaxHP())
        {
            effectingVal = target.getMaxHP() - target.getCurrentHP();
        }
        //if amount + current health > max health, set difference = max hp - current hp
        setTargetParam(target, 0, (int)(effectingVal));
        return(effectingVal);                   //effectingVal must be <0 and negate it
    }