public int Value(Living l) { int value; switch (damageType) { case DamageType.Physical: if (MeetsRequirements(l)) { value = (int)l.CalculateValue(baseValue, l.Strength - strRequirement, strScalingFactor, 0, l.Dexterity - dexRequirement, dexScalingFactor); return(value); } else { value = (int)l.CalculateValue(baseValue, strRequirement - l.Strength, -strScalingFactor, 0, dexRequirement - l.Dexterity, -dexScalingFactor); return(value); } case DamageType.Magic: if (MeetsRequirements(l)) { value = (int)l.CalculateValue(baseValue, l.Intelligence - intRequirement, intScalingFactor); return(value); } else { value = (int)l.CalculateValue(baseValue, intRequirement - l.Intelligence, -intScalingFactor); return(value); } default: throw new Exception("invalid damageType"); } }
public int Value(Living l, DamageType damageType) { int value; switch (damageType) { case DamageType.Physical: if (MeetsRequirements(l)) { value = physicalValue; return(value); } else { // now it's a armorvalue reduction as a penalty, it might do something compleetly different value = (int)l.CalculateValue(physicalValue, penaltyDif(l), reqPenalty); return(value); } case DamageType.Magic: if (MeetsRequirements(l)) { value = magicValue; return(value); } else { value = (int)l.CalculateValue(magicValue, penaltyDif(l), reqPenalty); return(value); } default: throw new Exception("invalide damageType"); } }
public void disarmTrap(Living l) { //attempt to disarm the trap, if succesfull trap is disarmed whithout the livingObject taking damage, else trap is sprung (same effect as stepping on it) int disarmChance = (int)l.CalculateValue(40, l.Luck, 0, 1); int disarmValue = GameEnvironment.Random.Next(100); if (disarmChance >= disarmValue)//check if the livingObject succesfully disarms the trap { triggered = true; if (l.GetType() == typeof(Player)) { (l as Player).ReceiveExp(trapExp); } } else { triggerdTrap(l); } }