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 }
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); }
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 }