예제 #1
0
파일: skill.cs 프로젝트: hsleung95/gameDev
    public void setTargetParam(gameChar target, int field, int effectVal)
    {
        switch (field)
        {
        case 0: target.setAttr <float>("currentHP", target.getAttr <float>("currentHP") + effectVal); break;

        case 1: target.setAttr <float>("currentMP", target.getAttr <float>("currentMP") + effectVal); break;

        case 2: target.setAttr <float>("attMod", target.getAttr <float>("attMod") + effectVal); break;

        case 3: target.setAttr <float>("defMod", target.getAttr <float>("defMod") + effectVal); break;

        case 4: target.setAttr <float>("intMod", target.getAttr <float>("intMod") + effectVal); break;
        }
    }
예제 #2
0
파일: skill.cs 프로젝트: hsleung95/gameDev
    public override float cast(gameChar source, gameChar target, int currentRound)
    {
        float sourceMP = source.getAttr <float>("currentMP");

        if (sourceMP < cost)
        {
            return(-1);
        }
        source.setAttr <float>("currentMP", sourceMP - cost);

        float effectingVal = 0;
        float magicDef     = target.getAttr <float>("intVal") + target.getAttr <float>("intMod");

        effectingVal = effectVal * (source.getAttr <float>("intVal") + source.getAttr <float>("intMod")) * 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.getAttr <float>("currentHP"))
        {
            effectingVal = -(target.getAttr <float>("currentHP"));
        }
        //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
    }
예제 #3
0
파일: skill.cs 프로젝트: hsleung95/gameDev
    public override float cast(gameChar source, gameChar target, int currentRound)
    {
        float sourceMP = source.getAttr <float>("currentMP");

        if (sourceMP < cost)
        {
            return(-1);
        }
        source.setAttr <float>("currentMP", sourceMP - cost);

        float effectingVal = 0;

        effectingVal = effectVal * source.getAttr <float>("intVal") * 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.setAttr <float>("maxHP", equiped.getAttr <float>("maxHP") - effectingVal);
                equiped.setAttr <float>("currentHP", equiped.getAttr <float>("currentHP") - effectingVal);
                break;
            }

            case 1: {
                equiped.setAttr <float>("maxMP", equiped.getAttr <float>("maxMP") - effectingVal);
                equiped.setAttr <float>("currentMP", equiped.getAttr <float>("currentMP") - effectingVal);
                break;
            }

            case 2: {
                equiped.setAttr <float>("attack", equiped.getAttr <float>("attack") - effectingVal);
                break;
            }

            case 3: {
                equiped.setAttr <float>("defense", equiped.getAttr <float>("defense") - effectingVal);
                break;
            }

            case 4: {
                equiped.setAttr <float>("intelligence", equiped.getAttr <float>("intelligence") - effectingVal);
                break;
            }

            default: {
                return(false);

                break;
            }
            }
        }
        return(true);
    }
예제 #5
0
파일: skill.cs 프로젝트: hsleung95/gameDev
    public override float cast(gameChar source, gameChar target, int currentRound)
    {
        float sourceMP = source.getAttr <float>("currentMP");

        if (sourceMP < cost)
        {
            return(-1);
        }
        source.setAttr <float>("currentMP", sourceMP - cost);

        float effectingVal = 0;

        effectingVal = effectVal * (source.getAttr <float>("intVal") + source.getAttr <float>("intMod")) * 1;
        //value = spellAmount * intelligence * amplifier
        if ((target.getAttr <float>("currentHP") + effectingVal) >= target.getAttr <float>("maxHP"))
        {
            effectingVal = target.getAttr <float>("maxHP") - target.getAttr <float>("currentHP");
        }
        //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
    }