public override void UseMagic(Player playerSender, PlayerWithMagic playerReciever, int power = 0) { //some messages about power int manToRestore; if (_artifactVolume != ArtifactVolume.None) { manToRestore = SetVolume(); } else { return; } if (playerReciever.MaxMana - playerReciever.ManaValue >= manToRestore) { playerReciever.ManaValue += manToRestore; playerSender.Inventory.ThrowAwayArtifact(this); } else if (playerReciever.ManaValue == playerReciever.MaxMana) { playerSender.Inventory.ThrowAwayArtifact(this); } else { playerReciever.ManaValue = playerReciever.MaxMana; } }
public override void UseMagic(PlayerWithMagic playerSender, Player player, int power = 0) { if (!playerSender.ManaChecker(power)) { Console.WriteLine("Player haven't got enough mana for spell!"); return; } if (!(playerSender.CanSpeak && VerbalComponent) || !(playerSender.CanMove && MotorComponent)) { Console.WriteLine("The player's state does not correspond to the verbal component"); return; } if (power >= MinManaValueForSpell) { if (player.State == PlayerParams.State.Dead) { player.Health = 1; player.StateCheck(); } playerSender.ManaValue -= MinManaValueForSpell; } }
public override void UseMagic(PlayerWithMagic playerSender, Player player, int power = 0) { if (!((playerSender.CanSpeak && VerbalComponent) || (playerSender.CanMove && MotorComponent))) { Console.WriteLine("The player's state does not correspond to the verbal component"); return; } int healthWillBeRestored; if (playerSender.ManaChecker(power)) { healthWillBeRestored = power / 2; } else { healthWillBeRestored = playerSender.ManaValue / 2; } int healthPlayerNeed = player.MaxHealth - player.Health; if (healthPlayerNeed >= healthWillBeRestored) { player.Health += healthWillBeRestored; playerSender.ManaValue -= healthWillBeRestored * 2; } else { player.Health = player.MaxHealth; playerSender.ManaValue -= healthPlayerNeed * 2; } player.StateCheck(); }
public override void UseMagic(PlayerWithMagic playerSender, Player player, int power = 0) { if (!playerSender.ManaChecker(power)) { Console.WriteLine("Player haven't got enough mana for spell!"); return; } if (!((playerSender.CanSpeak && VerbalComponent) || (playerSender.CanMove && MotorComponent))) { Console.WriteLine("The player's state does not correspond to the verbal component"); return; } DateTime tempEndArmor; if (power >= MinManaValueForSpell) { int interval = power / MinManaValueForSpell; tempEndArmor = DateTime.Now.AddMinutes(interval); playerSender.ManaValue -= MinManaValueForSpell * interval; player.EndArmorTime = tempEndArmor; player.IsArmored = true; } }
public override void UseMagic(Player playerSender, PlayerWithMagic playerReciever, int power = 0) { UseMagic(playerSender, playerReciever as Player, power); }
public abstract void UseMagic(Player playerSender, PlayerWithMagic playerReciever, int power = 0);