/// <summary> /// Returns the amount of points a Beast deals in damage. /// This damage could then be received by another character /// </summary> public int DealDamage() { int damage = _generator.Next(_minDamage, _maxDamage); string message = $"Beast ({_name}) dealt {damage} damage!"; _log.Save(message); return(damage); }
/// <summary> /// Returns the amount of points a Hero deals in damage. /// This damage could then be received by another character /// </summary> public int DealDamage() { int damage = _generator.Next(_minDamage, _maxDamage); string message = "Hero dealt " + damage + " damage!"; _log.Save(message); return(damage); }
/// <summary> /// Returns the amount of points a Beast deals in damage. /// This damage could then be received by another character /// </summary> public int DealDamage() { int damage = _generator.Next(10, 25); string message = $"Beast dealt {damage} damage!"; _log.Save(message); return(damage); }
/// <summary> /// Log data about the character to the battle log, /// in case the character is still alive. /// </summary> public void LogSurvivor() { if (!Dead) { BattleLog.Save(Name + " survived with " + _hitPoints + " hit points left"); } }
public override void ReceiveDamage(int points) { int percentRoll = NumberGenerator.Next(0, 100); if (percentRoll < 50) { // Reduced damage int reducedPoints = points * 60 / 100; // Reduce by 40 % _hitPoints = _hitPoints - reducedPoints; string message = Name + " receives " + reducedPoints + " damage (REDUCED), and is down to " + _hitPoints + " hit points"; BattleLog.Save(message); } else { // Normal damage _hitPoints = _hitPoints - points; string message = Name + " receives " + points + " damage, and is down to " + _hitPoints + " hit points"; BattleLog.Save(message); } if (Dead) { BattleLog.Save(Name + " died!"); } }
/// <summary> /// Returns the amount of points a Character deals in damage. /// This damage could then be received by another character. /// Note that there is a chance that the damage is modified. /// </summary> public int DealDamage() { int damage = RandomNumberGenerator.RandomNumber(_minDamage, _maxDamage); string message = $"{Name} dealt {damage} in damage"; BattleLog.Save(message); return(damage); }
/// <summary> /// Returns the amount of points a Character deals in damage. /// This damage could then be received by another character /// </summary> public virtual int DealDamage() { int damage = NumberGenerator.Next(_minDamage, _maxDamage); string message = Name + " dealt " + damage + " damage!"; BattleLog.Save(message); return(damage); }
/// <summary> /// Returns the amount of points a Character deals in damage. /// This damage could then be received by another character. /// Note that there is a chance that the damage is modified. /// </summary> public int DealDamage() { int damage = NumberGenerator.Next(_minDamage, _maxDamage); int modifiedDamage = DealDamageModify(damage); string damageDescription = (damage < modifiedDamage) ? "(INCREASED)" : ""; string message = $"{Name} dealt {modifiedDamage} damage {damageDescription}"; BattleLog.Save(message); return(modifiedDamage); }
/// <summary> /// The Character receives the amount of damage specified in the parameter. /// The number of hit points will decrease accordingly /// </summary> public virtual void ReceiveDamage(int points) { _hitPoints = _hitPoints - points; string message = Name + " receives " + points + " damage, and is down to " + _hitPoints + " hit points"; BattleLog.Save(message); if (Dead) { BattleLog.Save(Name + " died!"); } }
/// <summary> /// The Character receives the amount of damage specified in the parameter. /// The number of hit points will decrease accordingly. /// Note that there is a chance that the damage is modified. /// </summary> public void ReceiveDamage(int damage) { int modifiedDamage = ReceiveDamageModify(damage); _hitPoints = _hitPoints - modifiedDamage; string damageDescription = (damage > modifiedDamage) ? "(DECREASED)" : ""; string message = $"{Name} receives {modifiedDamage} damage {damageDescription}, and is down to {_hitPoints} HP"; BattleLog.Save(message); if (Dead) { BattleLog.Save(Name + " died!"); } }
public static void DoBattle(CharacterGroup groupA, CharacterGroup groupB) { while (!groupA.Dead && !groupB.Dead) { groupB.ReceiveDamage(groupA.DealDamage()); if (!groupB.Dead) { groupA.ReceiveDamage(groupB.DealDamage()); } } BattleLog.Save("--------------- BATTLE IS OVER ------------"); BattleLog.Save((groupA.Dead ? groupB.GroupName : groupA.GroupName) + " won! Status: "); groupA.LogSurvivor(); groupB.LogSurvivor(); BattleLog.PrintLog(); }
public override int DealDamage() { int percentRoll = NumberGenerator.Next(0, 100); int damage = NumberGenerator.Next(_minDamage, _maxDamage); if (percentRoll < 40) { // Increased damage damage = damage * 2; string message = Name + " dealt " + damage + " damage! (INCREASED)"; BattleLog.Save(message); } else { // Normal damage string message = Name + " dealt " + damage + " damage!"; BattleLog.Save(message); } return(damage); }