/// <summary> /// <see text="Overridden from " cref="Hero.doCritical(Monster, Hero)"/> /// </summary> public override void doCritical(Monster monster = null, Hero hero = null) { if (monster == null) { Logger.printMsgSystem("Sorry, but there is no Monster to attack!"); return; } Logger.printMsgSystem(String.Format("Hero {0} did a critical damage to {1}!", this.Name, monster.getMonsterName())); int criticalDamageToDeal = (int)(this.Damage * this.criticalChance) + this.Damage; monster.getDamage(criticalDamageToDeal, hero: this); }
/// <summary> /// <para>Deal damage to the Monster.</para> /// <para>Usage: you can leave Hero object empty and only pass a Monster instance as an argument.</para> /// </summary> /// <param name="monster">Monster to deal damage.</param> /// <param name="hero">Leave it empty.</param> public virtual void dealDamage(Monster monster = null, Hero hero = null) { if (monster == null) { Logger.printMsgSystem("Sorry, but there is no Monster to attack!"); return; } this.prepareToFight(); Logger.printMsgPlayer(String.Format("Hero {0} is starting hitting a monster {1}!", this.Name, monster.getMonsterName())); monster.getDamage(this.Damage, hero: this); }
/// <summary> /// <para>Get damage from the Monster.</para> /// <para>Usage: you can leave Hero object empty and only pass a Monster instance and damage as arguments.</para> /// </summary> /// <param name="damage">Damage to be taken.</param> /// <param name="monster">Monster to take damage from.</param> /// <param name="hero">Leave it empty.</param> public virtual void getDamage(int damage, Monster monster = null, Hero hero = null) { if (monster == null) { Logger.printMsgSystem("Sorry, but there is no Monster to get damage from!"); return; } this.Health -= damage; Logger.printMsgPlayer( String.Format( "Oh no, monster {0} dealed {1} damage to me, {2}!", monster.getMonsterName(), damage, this.Name)); }
/// <summary> /// <para>Deal damage to the Monster.</para> /// <para>Usage: you can leave Hero object empty and only pass a Monster instance as an argument.</para> /// </summary> /// <param name="monster">Monster to deal damage.</param> /// <param name="hero">Leave it empty.</param> public virtual void dealDamage(Monster monster = null, Hero hero = null) { if (monster == null) { Logger.printMsgSystem("Sorry, but there is no Monster to attack!"); return; } this.prepareToFight(); Logger.printMsgPlayer(String.Format("Hero {0} is starting hitting a monster {1}!", this.Name, monster.getMonsterName())); monster.getDamage(this.Damage, hero: this); }
/// <summary> /// <see text="Overridden from " cref="Hero.doCritical(Monster, Hero)"/> /// </summary> public override void doCritical(Monster monster = null, Hero hero = null) { if (monster == null) { Logger.printMsgSystem("Sorry, but there is no Monster to attack!"); return; } Logger.printMsgSystem(String.Format("Hero {0} did a critical damage to {1}!", this.Name, monster.getMonsterName())); int criticalDamageToDeal = (int)(this.Damage * this.criticalChance) + this.Damage; monster.getDamage(criticalDamageToDeal, hero: this); }
/// <summary> /// <para>Get damage from the Monster.</para> /// <para>Usage: you can leave Hero object empty and only pass a Monster instance and damage as arguments.</para> /// </summary> /// <param name="damage">Damage to be taken.</param> /// <param name="monster">Monster to take damage from.</param> /// <param name="hero">Leave it empty.</param> public virtual void getDamage(int damage, Monster monster = null, Hero hero = null) { if (monster == null) { Logger.printMsgSystem("Sorry, but there is no Monster to get damage from!"); return; } this.Health -= damage; Logger.printMsgPlayer( String.Format( "Oh no, monster {0} dealed {1} damage to me, {2}!", monster.getMonsterName(), damage, this.Name)); }