Exemplo n.º 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;

        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
    }
Exemplo n.º 2
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);
    }