/// <summary> /// Action /// </summary> /// <param name="living"></param> public override void Execute(GameLiving living) { if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED | INCOMBAT)) return; int heal = 0; switch (Level) { case 1: heal = 25; break; case 2: heal = 60; break; case 3: heal = 100; break; } int healed = living.ChangeHealth(living, GameLiving.eHealthChangeType.Spell, living.MaxHealth * heal / 100); SendCasterSpellEffectAndCastMessage(living, 7001, healed > 0); GamePlayer player = living as GamePlayer; if (player != null) { if (healed > 0) player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client, "FirstAidAbility.Execute.HealYourself", healed), eChatType.CT_Spell, eChatLoc.CL_SystemWindow); if (heal > healed) { player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client, "FirstAidAbility.Execute.FullyHealed"), eChatType.CT_Spell, eChatLoc.CL_SystemWindow); } } if (healed > 0) DisableSkill(living); }
/// <summary> /// Action /// </summary> /// <param name="living"></param> public override void Execute(GameLiving living) { if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return; int heal = 0; switch (Level) { case 1: heal = 20; break; case 2: heal = 50; break; case 3: heal = 80; break; } int healed = living.ChangeHealth(living, GameLiving.eHealthChangeType.Spell, living.MaxHealth * heal / 100); SendCasterSpellEffectAndCastMessage(living, 7004, healed > 0); GamePlayer player = living as GamePlayer; if (player != null) { if (healed > 0) player.Out.SendMessage("You heal yourself for " + healed + " hit points.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow); if (heal > healed) { player.Out.SendMessage("You are fully healed.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow); } } if (healed > 0) DisableSkill(living); }
/// <summary> /// Action /// </summary> /// <param name="living"></param> public override void Execute(GameLiving living) { if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED | INCOMBAT)) { return; } int heal = 0; if (ServerProperties.Properties.USE_NEW_ACTIVES_RAS_SCALING) { switch (Level) { case 1: heal = 25; break; case 2: heal = 40; break; case 3: heal = 60; break; case 4: heal = 80; break; case 5: heal = 100; break; } } else { switch (Level) { case 1: heal = 25; break; case 2: heal = 60; break; case 3: heal = 100; break; } } int healed = living.ChangeHealth(living, GameLiving.eHealthChangeType.Spell, living.MaxHealth * heal / 100); SendCasterSpellEffectAndCastMessage(living, 7001, healed > 0); if (living is GamePlayer player) { if (healed > 0) { player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "FirstAidAbility.Execute.HealYourself", healed), eChatType.CT_Spell, eChatLoc.CL_SystemWindow); } if (heal > healed) { player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "FirstAidAbility.Execute.FullyHealed"), eChatType.CT_Spell, eChatLoc.CL_SystemWindow); } } if (healed > 0) { DisableSkill(living); } }
/// <summary> /// Action /// </summary> /// <param name="living"></param> public override void Execute(GameLiving living) { if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) { return; } int heal = 0; if (ServerProperties.Properties.USE_NEW_ACTIVES_RAS_SCALING) { switch (Level) { case 1: heal = 20; break; case 2: heal = 35; break; case 3: heal = 50; break; case 4: heal = 65; break; case 5: heal = 80; break; } } else { switch (Level) { case 1: heal = 20; break; case 2: heal = 50; break; case 3: heal = 80; break; } } int healed = living.ChangeHealth(living, GameLiving.eHealthChangeType.Spell, living.MaxHealth * heal / 100); SendCasterSpellEffectAndCastMessage(living, 7004, healed > 0); GamePlayer player = living as GamePlayer; if (player != null) { if (healed > 0) { player.Out.SendMessage("You heal yourself for " + healed + " hit points.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow); } if (heal > healed) { player.Out.SendMessage("You are fully healed.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow); } } if (healed > 0) { DisableSkill(living); } }
/// <summary> /// Hurl a player into the air. /// </summary> /// <param name="target">The player to hurl into the air.</param> private void ThrowLiving(GameLiving target) { BroadcastMessage(string.Format("{0} is hurled into the air!", target.Name)); // Face the target, then push it 700 units up and 300 - 500 units backwards. TurnTo(target); Point3D targetPosition = PositionOfTarget(target, 700, Heading, Util.Random(300, 500)); if (target is GamePlayer) { target.MoveTo(target.CurrentRegionID, targetPosition.X, targetPosition.Y, targetPosition.Z, target.Heading); } else if (target is GameNPC) { (target as GameNPC).MoveInRegion(target.CurrentRegionID, targetPosition.X, targetPosition.Y, targetPosition.Z, target.Heading, true); target.ChangeHealth(this, eHealthChangeType.Spell, (int)(target.Health * -0.35)); } }
public override void OnDirectEffect(GameLiving target, double effectiveness) { if (target == null) { return; } if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active) { return; } GamePlayer player = target as GamePlayer; if (target is GamePlayer) { switch (Spell.DamageType) { //Warlord ML 2 case (eDamageType)((byte)0): { int mana; int health; int end; int value = (int)Spell.Value; mana = (target.MaxMana * value) / 100; end = (target.MaxEndurance * value) / 100; health = (target.MaxHealth * value) / 100; if (target.Health + health > target.MaxHealth) { target.Health = target.MaxHealth; } else { target.Health += health; } if (target.Mana + mana > target.MaxMana) { target.Mana = target.MaxMana; } else { target.Mana += mana; } if (target.Endurance + end > target.MaxEndurance) { target.Endurance = target.MaxEndurance; } else { target.Endurance += end; } SendEffectAnimation(target, 0, false, 1); } break; //warlord ML8 case (eDamageType)((byte)1): { int healvalue = (int)m_spell.Value; int heal; if (target.IsAlive && !GameServer.ServerRules.IsAllowedToAttack(Caster, player, true)) { heal = target.ChangeHealth(target, GameLiving.eHealthChangeType.Spell, healvalue); if (heal != 0) { player.Out.SendMessage(m_caster.Name + " heal you for " + heal + " hit point!", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow); } } heal = m_caster.ChangeHealth(Caster, GameLiving.eHealthChangeType.Spell, (int)(-m_caster.Health * 90 / 100)); if (heal != 0) { MessageToCaster("You lose " + heal + " hit point" + (heal == 1 ? "." : "s."), eChatType.CT_Spell); } SendEffectAnimation(target, 0, false, 1); } break; } } }
/// <summary> /// A heal generated by an item proc. /// </summary> /// <param name="target"></param> /// <param name="amount"></param> /// <returns></returns> public virtual bool ProcHeal(GameLiving target, int amount) { if (target == null || target.ObjectState != GameLiving.eObjectState.Active) return false; // we can't heal people we can attack if (GameServer.ServerRules.IsAllowedToAttack(Caster, target, true)) return false; if (!target.IsAlive) return false; // no healing of keep components if (target is Keeps.GameKeepComponent || target is Keeps.GameKeepDoor) return false; int heal = target.ChangeHealth(Caster, GameLiving.eHealthChangeType.Spell, amount); if (m_caster == target && heal > 0) { MessageToCaster("You heal yourself for " + heal + " hit points.", eChatType.CT_Spell); if (heal < amount) { MessageToCaster("You are fully healed.", eChatType.CT_Spell); #region PVP DAMAGE if (target is NecromancerPet && ((target as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() != null || target is GamePlayer) { if (target.DamageRvRMemory > 0) target.DamageRvRMemory = 0; //Remise a zéro compteur dommages/heal rps } #endregion PVP DAMAGE } } else if (heal > 0) { MessageToCaster("You heal " + target.GetName(0, false) + " for " + heal + " hit points!", eChatType.CT_Spell); MessageToLiving(target, "You are healed by " + m_caster.GetName(0, false) + " for " + heal + " hit points.", eChatType.CT_Spell); #region PVP DAMAGE if (heal < amount) { if (target is NecromancerPet && ((target as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() != null || target is GamePlayer) { if (target.DamageRvRMemory > 0) target.DamageRvRMemory = 0; //Remise a zéro compteur dommages/heal rps } } else { if (target is NecromancerPet && ((target as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() != null || target is GamePlayer) { if (target.DamageRvRMemory > 0) target.DamageRvRMemory -= (long)Math.Max(heal, 0); } } } #endregion PVP DAMAGE return true; }
/// <summary> /// Heals hit points of one target and sends needed messages, no spell effects /// </summary> /// <param name="target"></param> /// <param name="amount">amount of hit points to heal</param> /// <returns>true if heal was done</returns> public virtual bool HealTarget(GameLiving target, int amount) { if (target == null || target.ObjectState != GameLiving.eObjectState.Active) return false; // we can't heal people we can attack if (GameServer.ServerRules.IsAllowedToAttack(Caster, target, true)) return false; // no healing of keep components if (target is Keeps.GameKeepComponent || target is Keeps.GameKeepDoor) return false; if (!target.IsAlive) { //"You cannot heal the dead!" sshot550.tga MessageToCaster(target.GetName(0, true) + " is dead!", eChatType.CT_SpellResisted); return false; } if (target is GamePlayer && (target as GamePlayer).NoHelp && Caster is GamePlayer) { //player not grouped, anyone else //player grouped, different group if ((target as GamePlayer).Group == null || (Caster as GamePlayer).Group == null || (Caster as GamePlayer).Group != (target as GamePlayer).Group) { MessageToCaster("That player does not want assistance", eChatType.CT_SpellResisted); return false; } } amount = (int)(amount * 1.00); //moc heal decrease double mocFactor = 1.0; MasteryofConcentrationEffect moc = Caster.EffectList.GetOfType<MasteryofConcentrationEffect>(); if (moc != null) { GamePlayer playerCaster = Caster as GamePlayer; RealmAbility ra = playerCaster.GetAbility<MasteryofConcentrationAbility>(); if (ra != null) mocFactor = System.Math.Round((double)ra.Level * 25 / 100, 2); amount = (int)Math.Round(amount * mocFactor); } int criticalvalue = 0; int criticalchance = Caster.GetModified(eProperty.CriticalHealHitChance); double effectiveness = 0; if (Caster is GamePlayer) effectiveness = ((GamePlayer)Caster).Effectiveness + Caster.GetModified(eProperty.HealingEffectiveness) * 0.01; if (Caster is GameNPC) effectiveness = 1.0; //USE DOUBLE ! double cache = (double)amount * effectiveness; amount = (int)cache; if (Util.Chance(criticalchance)) criticalvalue = Util.Random(amount / 10, amount / 2 + 1); amount += criticalvalue; GamePlayer playerTarget = target as GamePlayer; if (playerTarget != null) { GameSpellEffect HealEffect = SpellHandler.FindEffectOnTarget(playerTarget, "EfficientHealing"); if (HealEffect != null) { double HealBonus = amount * ((int)HealEffect.Spell.Value * 0.01); amount += (int)HealBonus; playerTarget.Out.SendMessage("Your Efficient Healing buff grants you a additional" + HealBonus + " in the Heal!", eChatType.CT_Spell, eChatLoc.CL_ChatWindow); } GameSpellEffect EndEffect = SpellHandler.FindEffectOnTarget(playerTarget, "EfficientEndurance"); if (EndEffect != null) { double EndBonus = amount * ((int)EndEffect.Spell.Value * 0.01); //600 / 10 = 60end playerTarget.Endurance += (int)EndBonus; playerTarget.Out.SendMessage("Your Efficient Endurance buff grants you " + EndBonus + " Endurance from the Heal!", eChatType.CT_Spell, eChatLoc.CL_ChatWindow); } } GameSpellEffect flaskHeal = FindEffectOnTarget(target, "HealFlask"); if (flaskHeal != null) { amount += (int)((amount * flaskHeal.Spell.Value) * 0.01); } int heal = target.ChangeHealth(Caster, GameLiving.eHealthChangeType.Spell, amount); #region PVP DAMAGE long healedrp = 0; if (target.DamageRvRMemory > 0 && (target is NecromancerPet && ((target as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() != null || target is GamePlayer)) { healedrp = (long)Math.Max(heal, 0); target.DamageRvRMemory -= healedrp; } if (heal == 0) { if (Spell.Pulse == 0) { if (target == m_caster) MessageToCaster("You are fully healed.", eChatType.CT_SpellResisted); else MessageToCaster(target.GetName(0, true) + " is fully healed.", eChatType.CT_SpellResisted); } return false; } if (m_caster is GamePlayer && target is NecromancerPet && ((target as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() != null || target is GamePlayer && healedrp > 0) { int POURCENTAGE_SOIN_RP = ServerProperties.Properties.HEAL_PVP_DAMAGE_VALUE_RP; // ...% de bonus RP pour les soins effectués if (m_spell.Pulse == 0 && m_caster.CurrentRegionID != 242 && // On Exclu zone COOP m_spell.SpellType.ToLower() != "spreadheal" && target != m_caster && m_spellLine.KeyName != GlobalSpellsLines.Item_Spells && m_spellLine.KeyName != GlobalSpellsLines.Potions_Effects && m_spellLine.KeyName != GlobalSpellsLines.Combat_Styles_Effect && m_spellLine.KeyName != GlobalSpellsLines.Reserved_Spells) { GamePlayer player = m_caster as GamePlayer; if (player != null) { long Bonus_RP_Soin = Convert.ToInt64((double)healedrp * POURCENTAGE_SOIN_RP / 100.0); if (Bonus_RP_Soin >= 1) { PlayerStatistics stats = player.Statistics as PlayerStatistics; if (stats != null) { stats.RPEarnedFromHitPointsHealed += (uint)Bonus_RP_Soin; stats.HitPointsHealed += (uint)healedrp; } player.GainRealmPoints(Bonus_RP_Soin, false); player.Out.SendMessage("Vous gagnez " + Bonus_RP_Soin.ToString() + " points de royaume pour avoir soigné un membre de votre royaume.", eChatType.CT_Important, eChatLoc.CL_SystemWindow); } } } } #endregion PVP DAMAGE if (m_caster == target) { MessageToCaster("You heal yourself for " + heal + " hit points.", eChatType.CT_Spell); if (heal < amount) { #region PVP DAMAGE if (target is NecromancerPet && ((target as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() != null || target is GamePlayer) { if (target.DamageRvRMemory > 0) target.DamageRvRMemory = 0; //Remise a zéro compteur dommages/heal rps } #endregion PVP DAMAGE MessageToCaster("You are fully healed.", eChatType.CT_Spell); } } else { MessageToCaster("You heal " + target.GetName(0, false) + " for " + heal + " hit points!", eChatType.CT_Spell); MessageToLiving(target, "You are healed by " + m_caster.GetName(0, false) + " for " + heal + " hit points.", eChatType.CT_Spell); if (heal < amount) { #region PVP DAMAGE if (target is NecromancerPet && ((target as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() != null || target is GamePlayer) { if (target.DamageRvRMemory > 0) target.DamageRvRMemory = 0; //Remise a zéro compteur dommages/heal rps } #endregion PVP DAMAGE MessageToCaster(target.GetName(0, true) + " is fully healed.", eChatType.CT_Spell); } if (heal > 0 && criticalvalue > 0) MessageToCaster("Your heal criticals for an extra " + criticalvalue + " amount of hit points!", eChatType.CT_Spell); } return true; }
/// <summary> /// Heals hit points of one target and sends needed messages, no spell effects /// </summary> /// <param name="target"></param> /// <param name="amount">amount of hit points to heal</param> /// <returns>true if heal was done</returns> public virtual bool HealTarget(GameLiving target, int amount) { if (target == null || target.ObjectState != GameLiving.eObjectState.Active) return false; // we can't heal people we can attack if (GameServer.ServerRules.IsAllowedToAttack(Caster, target, true)) return false; if (!target.IsAlive) { MessageToCaster(target.GetName(0, true) + " is dead!", eChatType.CT_SpellResisted); return false; } if (m_caster == target) { MessageToCaster("You cannot transfer life to yourself.", eChatType.CT_SpellResisted); return false; } if (amount <= 0) //Player does not have enough health to transfer { MessageToCaster("You do not have enough health to transfer.", eChatType.CT_SpellResisted); return false; } int heal = target.ChangeHealth(Caster, GameLiving.eHealthChangeType.Spell, amount); #region PVP DAMAGE long healedrp = 0; if (m_caster is NecromancerPet && ((m_caster as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() != null || m_caster is GamePlayer) { if (target is NecromancerPet && ((target as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() != null || target is GamePlayer) { if (target.DamageRvRMemory > 0) { healedrp = (long)Math.Max(heal, 0); target.DamageRvRMemory -= healedrp; } } } if (healedrp > 0 && m_caster != target && m_spellLine.KeyName != GlobalSpellsLines.Item_Spells && m_caster.CurrentRegionID != 242 && m_spell.Pulse == 0) // On Exclu zone COOP { GamePlayer joueur_a_considerer = (m_caster is NecromancerPet ? ((m_caster as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() : m_caster as GamePlayer); int POURCENTAGE_SOIN_RP = ServerProperties.Properties.HEAL_PVP_DAMAGE_VALUE_RP; // ...% de bonus RP pour les soins effectués long Bonus_RP_Soin = Convert.ToInt64((double)healedrp * POURCENTAGE_SOIN_RP / 100); if (Bonus_RP_Soin >= 1) { PlayerStatistics stats = joueur_a_considerer.Statistics as PlayerStatistics; if (stats != null) { stats.RPEarnedFromHitPointsHealed += (uint)Bonus_RP_Soin; stats.HitPointsHealed += (uint)healedrp; } joueur_a_considerer.GainRealmPoints(Bonus_RP_Soin, false); joueur_a_considerer.Out.SendMessage("Vous gagnez " + Bonus_RP_Soin.ToString() + " points de royaume pour avoir soigné un membre de votre royaume.", eChatType.CT_Important, eChatLoc.CL_SystemWindow); } } #endregion PVP DAMAGE if (heal == 0) { if (Spell.Pulse == 0) { MessageToCaster(target.GetName(0, true) + " is fully healed.", eChatType.CT_SpellResisted); } return false; } MessageToCaster("You heal " + target.GetName(0, false) + " for " + heal + " hit points!", eChatType.CT_Spell); MessageToLiving(target, "You are healed by " + m_caster.GetName(0, false) + " for " + heal + " hit points.", eChatType.CT_Spell); if (heal < amount) MessageToCaster(target.GetName(0, true) + " is fully healed.", eChatType.CT_Spell); return true; }
/// <summary> /// A heal generated by an item proc. /// </summary> /// <param name="target"></param> /// <param name="amount"></param> /// <returns></returns> public virtual bool ProcHeal(GameLiving target, double amount) { if (target == null || target.ObjectState != GameObject.eObjectState.Active) { return(false); } // we can't heal people we can attack if (GameServer.ServerRules.IsAllowedToAttack(Caster, target, true)) { return(false); } if (!target.IsAlive) { return(false); } // no healing of keep components if (target is Keeps.GameKeepComponent || target is Keeps.GameKeepDoor) { return(false); } // Scale spells that are cast by pets if (Caster is GamePet && !(Caster is NecromancerPet) && ServerProperties.Properties.PET_SCALE_SPELL_MAX_LEVEL > 0) { amount = ScalePetHeal(amount); } int heal = target.ChangeHealth(Caster, GameLiving.eHealthChangeType.Spell, (int)Math.Round(amount)); if (Caster == target && heal > 0) { MessageToCaster($"You heal yourself for {heal} hit points.", eChatType.CT_Spell); if (heal < amount) { MessageToCaster("You are fully healed.", eChatType.CT_Spell); if (((target as NecromancerPet)?.Brain as IControlledBrain)?.GetPlayerOwner() != null || target is GamePlayer) { if (target.DamageRvRMemory > 0) { target.DamageRvRMemory = 0; // Remise a zéro compteur dommages/heal rps } } } } else if (heal > 0) { MessageToCaster($"You heal {target.GetName(0, false)} for {heal} hit points!", eChatType.CT_Spell); MessageToLiving(target, $"You are healed by {Caster.GetName(0, false)} for {heal} hit points.", eChatType.CT_Spell); if (heal < amount) { if (((target as NecromancerPet)?.Brain as IControlledBrain)?.GetPlayerOwner() != null || target is GamePlayer) { if (target.DamageRvRMemory > 0) { target.DamageRvRMemory = 0; // Remise a zéro compteur dommages/heal rps } } } else { if (((target as NecromancerPet)?.Brain as IControlledBrain)?.GetPlayerOwner() != null || target is GamePlayer) { if (target.DamageRvRMemory > 0) { target.DamageRvRMemory -= Math.Max(heal, 0); } } } } return(true); }
public override void OnDirectEffect(GameLiving target, double effectiveness) { if (target == null) return; if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active) return; GamePlayer player = target as GamePlayer; if (target is GamePlayer) { switch (Spell.DamageType) { //Warlord ML 2 case (eDamageType)((byte)0): { int mana; int health; int end; int value = (int)Spell.Value; mana = (target.MaxMana * value) / 100; end = (target.MaxEndurance * value) / 100; health = (target.MaxHealth * value) / 100; if (target.Health + health > target.MaxHealth) target.Health = target.MaxHealth; else target.Health += health; if (target.Mana + mana > target.MaxMana) target.Mana = target.MaxMana; else target.Mana += mana; if (target.Endurance + end > target.MaxEndurance) target.Endurance = target.MaxEndurance; else target.Endurance += end; SendEffectAnimation(target, 0, false, 1); } break; //warlord ML8 case (eDamageType)((byte)1): { int healvalue = (int)m_spell.Value; int heal; if (target.IsAlive && !GameServer.ServerRules.IsAllowedToAttack(Caster, player, true)) { heal = target.ChangeHealth(target, GameLiving.eHealthChangeType.Spell, healvalue); if (heal != 0) player.Out.SendMessage(m_caster.Name + " heal you for " + heal + " hit point!", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow); } heal = m_caster.ChangeHealth(Caster, GameLiving.eHealthChangeType.Spell, (int)(-m_caster.Health * 90 / 100)); if (heal != 0) MessageToCaster("You lose " + heal + " hit point" + (heal == 1 ? "." : "s."), eChatType.CT_Spell); SendEffectAnimation(target, 0, false, 1); } break; } } }
private void OnAttack(DOLEvent e, object sender, EventArgs arguments) { GameLiving living = sender as GameLiving; if (living == null) { return; } AttackFinishedEventArgs args = arguments as AttackFinishedEventArgs; if (args == null) { return; } if (args.AttackData == null) { return; } int extra = 0; if (args.AttackData.StyleDamage > 0) { extra = args.AttackData.StyleDamage; args.AttackData.Damage += args.AttackData.StyleDamage; args.AttackData.StyleDamage *= 2; } GamePlayer player = sender as GamePlayer; if (player == null) { return; } if (player.Group == null) { return; } if (extra > 0) { player.Out.SendMessage("Your Fury enables you to strike " + args.AttackData.Target.Name + " for " + extra + " additional points of damage", eChatType.CT_Spell, eChatLoc.CL_SystemWindow); } Hashtable injuredTargets = new Hashtable(); GamePlayer mostInjuredLiving = null; foreach (GamePlayer p in player.Group.GetPlayersInTheGroup()) { if (p == player) { continue; } mostInjuredLiving = p; break; } if (mostInjuredLiving == null) { return; } double mostInjuredPercent = mostInjuredLiving.Health / (float)mostInjuredLiving.MaxHealth; int groupHealCap = args.AttackData.Damage; int targetHealCap = args.AttackData.Damage; if (player.Group.MemberCount > 2) { groupHealCap *= (player.Group.MemberCount); targetHealCap *= 2; foreach (GamePlayer p in player.Group.GetPlayersInTheGroup()) { if (!p.IsAlive) { continue; } if (p == player) { continue; } if (p.IsWithinRadius(player, 2000)) { double playerHealthPercent = p.Health / (double)p.MaxHealth; if (playerHealthPercent < 1) { injuredTargets.Add(p, playerHealthPercent); if (playerHealthPercent < mostInjuredPercent) { mostInjuredLiving = p; mostInjuredPercent = playerHealthPercent; } } } } } else { if (mostInjuredPercent < 1) { injuredTargets.Add(mostInjuredLiving, mostInjuredPercent); } } if (mostInjuredPercent >= 1) { player.Out.SendMessage("Your group is fully healed!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow); return; } double bestHealPercent = targetHealCap / (double)mostInjuredLiving.MaxHealth; double totalHealed = 0; Hashtable healAmount = new Hashtable(); IDictionaryEnumerator iter = injuredTargets.GetEnumerator(); //calculate heal for all targets while (iter.MoveNext()) { GameLiving healTarget = iter.Key as GameLiving; double targetHealthPercent = (double)iter.Value; //targets hp percent after heal is same as mostInjuredLiving double targetHealPercent = bestHealPercent + mostInjuredPercent - targetHealthPercent; int targetHeal = (int)(healTarget.MaxHealth * targetHealPercent); //DOLConsole.WriteLine("SpreadHeal: targetHealPercent=" + targetHealPercent + "; uncapped targetHeal=" + targetHeal + "; bestHealPercent=" + bestHealPercent + "; mostInjuredPercent=" + mostInjuredPercent + "; targetHealthPercent=" + targetHealthPercent); if (targetHeal > 0) { totalHealed += targetHeal; healAmount.Add(healTarget, targetHeal); } } iter = healAmount.GetEnumerator(); //reduce healed hp according to targetHealCap and heal targets while (iter.MoveNext()) { GameLiving healTarget = iter.Key as GameLiving; if (!healTarget.IsAlive) { continue; } double uncappedHeal = (int)iter.Value; int reducedHeal = (int)Math.Min(targetHealCap, uncappedHeal * (groupHealCap / totalHealed)); //heal target int baseheal = healTarget.MaxHealth - healTarget.Health; if (reducedHeal < baseheal) { baseheal = reducedHeal; } healTarget.ChangeHealth(player, GameLiving.eHealthChangeType.Spell, baseheal); player.Out.SendMessage("You heal " + healTarget.Name + " for " + baseheal + "!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow); if (healTarget is GamePlayer) { ((GamePlayer)healTarget).Out.SendMessage(player.Name + " heals you for " + baseheal + "!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow); } } return; }
/// <summary> /// A heal generated by an item proc. /// </summary> /// <param name="target"></param> /// <param name="amount"></param> /// <returns></returns> public virtual bool ProcHeal(GameLiving target, int amount) { if (target == null || target.ObjectState != GameLiving.eObjectState.Active) return false; // we can't heal people we can attack if (GameServer.ServerRules.IsAllowedToAttack(Caster, target, true)) return false; if (!target.IsAlive) return false; // no healing of keep components if (target is Keeps.GameKeepComponent || target is Keeps.GameKeepDoor) return false; int heal = target.ChangeHealth(Caster, GameLiving.eHealthChangeType.Spell, amount); if (m_caster == target && heal > 0) { MessageToCaster("You heal yourself for " + heal + " hit points.", eChatType.CT_Spell); if (heal < amount) { MessageToCaster("You are fully healed.", eChatType.CT_Spell); } } else if (heal > 0) { MessageToCaster("You heal " + target.GetName(0, false) + " for " + heal + " hit points!", eChatType.CT_Spell); MessageToLiving(target, "You are healed by " + m_caster.GetName(0, false) + " for " + heal + " hit points.", eChatType.CT_Spell); } return true; }
/// <summary> /// Heals hit points of one target and sends needed messages, no spell effects /// </summary> /// <param name="target"></param> /// <param name="amount">amount of hit points to heal</param> /// <returns>true if heal was done</returns> public virtual bool HealTarget(GameLiving target, int amount) { if (target == null || target.ObjectState != GameLiving.eObjectState.Active) return false; // we can't heal people we can attack if (GameServer.ServerRules.IsAllowedToAttack(Caster, target, true)) return false; // no healing of keep components if (target is Keeps.GameKeepComponent || target is Keeps.GameKeepDoor) return false; if (!target.IsAlive) { //"You cannot heal the dead!" sshot550.tga MessageToCaster(target.GetName(0, true) + " is dead!", eChatType.CT_SpellResisted); return false; } if (target is GamePlayer && (target as GamePlayer).NoHelp && Caster is GamePlayer) { //player not grouped, anyone else //player grouped, different group if ((target as GamePlayer).Group == null || (Caster as GamePlayer).Group == null || (Caster as GamePlayer).Group != (target as GamePlayer).Group) { MessageToCaster("That player does not want assistance", eChatType.CT_SpellResisted); return false; } } amount = (int)(amount * 1.00); //moc heal decrease double mocFactor = 1.0; MasteryofConcentrationEffect moc = Caster.EffectList.GetOfType<MasteryofConcentrationEffect>(); if (moc != null) { GamePlayer playerCaster = Caster as GamePlayer; RealmAbility ra = playerCaster.GetAbility<MasteryofConcentrationAbility>(); if (ra != null) mocFactor = System.Math.Round((double)ra.Level * 25 / 100, 2); amount = (int)Math.Round(amount * mocFactor); } int criticalvalue = 0; int criticalchance = Caster.GetModified(eProperty.CriticalHealHitChance); double effectiveness = 0; if (Caster is GamePlayer) effectiveness = ((GamePlayer)Caster).Effectiveness + Caster.GetModified(eProperty.HealingEffectiveness) * 0.01; if (Caster is GameNPC) effectiveness = 1.0; //USE DOUBLE ! double cache = (double)amount * effectiveness; amount = (int)cache; if (Util.Chance(criticalchance)) criticalvalue = Util.Random(amount / 10, amount / 2 + 1); amount += criticalvalue; GamePlayer playerTarget = target as GamePlayer; if (playerTarget != null) { GameSpellEffect HealEffect = SpellHandler.FindEffectOnTarget(playerTarget, "EfficientHealing"); if (HealEffect != null) { double HealBonus = amount * ((int)HealEffect.Spell.Value * 0.01); amount += (int)HealBonus; playerTarget.Out.SendMessage("Your Efficient Healing buff grants you a additional" + HealBonus + " in the Heal!", eChatType.CT_Spell, eChatLoc.CL_ChatWindow); } GameSpellEffect EndEffect = SpellHandler.FindEffectOnTarget(playerTarget, "EfficientEndurance"); if (EndEffect != null) { double EndBonus = amount * ((int)EndEffect.Spell.Value * 0.01); //600 / 10 = 60end playerTarget.Endurance += (int)EndBonus; playerTarget.Out.SendMessage("Your Efficient Endurance buff grants you " + EndBonus + " Endurance from the Heal!", eChatType.CT_Spell, eChatLoc.CL_ChatWindow); } } GameSpellEffect flaskHeal = FindEffectOnTarget(target, "HealFlask"); if(flaskHeal != null) { amount += (int) ((amount*flaskHeal.Spell.Value)*0.01); } int heal = target.ChangeHealth(Caster, GameLiving.eHealthChangeType.Spell, amount); if (heal == 0) { if (Spell.Pulse == 0) { if (target == m_caster) MessageToCaster("You are fully healed.", eChatType.CT_SpellResisted); else MessageToCaster(target.GetName(0, true) + " is fully healed.", eChatType.CT_SpellResisted); } return false; } if (m_caster == target) { MessageToCaster("You heal yourself for " + heal + " hit points.", eChatType.CT_Spell); if (heal < amount) MessageToCaster("You are fully healed.", eChatType.CT_Spell); } else { MessageToCaster("You heal " + target.GetName(0, false) + " for " + heal + " hit points!", eChatType.CT_Spell); MessageToLiving(target, "You are healed by " + m_caster.GetName(0, false) + " for " + heal + " hit points.", eChatType.CT_Spell); if (heal < amount) MessageToCaster(target.GetName(0, true) + " is fully healed.", eChatType.CT_Spell); if (heal > 0 && criticalvalue > 0) MessageToCaster("Your heal criticals for an extra " + criticalvalue + " amount of hit points!", eChatType.CT_Spell); } return true; }
/// <summary> /// Heals hit points of one target and sends needed messages, no spell effects /// </summary> /// <param name="target"></param> /// <param name="amount">amount of hit points to heal</param> /// <returns>true if heal was done</returns> public virtual bool HealTarget(GameLiving target, int amount) { if (target == null || target.ObjectState != GameLiving.eObjectState.Active) { return(false); } // we can't heal people we can attack if (GameServer.ServerRules.IsAllowedToAttack(Caster, target, true)) { return(false); } // no healing of keep components if (target is Keeps.GameKeepComponent || target is Keeps.GameKeepDoor) { return(false); } if (!target.IsAlive) { //"You cannot heal the dead!" sshot550.tga MessageToCaster(target.GetName(0, true) + " is dead!", eChatType.CT_SpellResisted); return(false); } if (target is GamePlayer && (target as GamePlayer).NoHelp && Caster is GamePlayer) { //player not grouped, anyone else //player grouped, different group if ((target as GamePlayer).Group == null || (Caster as GamePlayer).Group == null || (Caster as GamePlayer).Group != (target as GamePlayer).Group) { MessageToCaster("That player does not want assistance", eChatType.CT_SpellResisted); return(false); } } //moc heal decrease double mocFactor = 1.0; MasteryofConcentrationEffect moc = Caster.EffectList.GetOfType <MasteryofConcentrationEffect>(); if (moc != null) { GamePlayer playerCaster = Caster as GamePlayer; MasteryofConcentrationAbility ra = playerCaster.GetAbility <MasteryofConcentrationAbility>(); if (ra != null) { mocFactor = System.Math.Round((double)ra.GetAmountForLevel(ra.Level) / 100, 2); } amount = (int)Math.Round(amount * mocFactor); } int criticalvalue = 0; int criticalchance = Caster.GetModified(eProperty.CriticalHealHitChance); double effectiveness = 0; if (Caster is GamePlayer) { effectiveness = ((GamePlayer)Caster).Effectiveness + Caster.GetModified(eProperty.HealingEffectiveness) * 0.01; } if (Caster is GameNPC) { effectiveness = 1.0; } //USE DOUBLE ! double cache = (double)amount * effectiveness; amount = (int)cache; if (Util.Chance(criticalchance)) { criticalvalue = Util.Random(amount / 10, amount / 2 + 1); } amount += criticalvalue; GamePlayer playerTarget = target as GamePlayer; if (playerTarget != null) { GameSpellEffect HealEffect = SpellHandler.FindEffectOnTarget(playerTarget, "EfficientHealing"); if (HealEffect != null) { double HealBonus = amount * ((int)HealEffect.Spell.Value * 0.01); amount += (int)HealBonus; playerTarget.Out.SendMessage("Your Efficient Healing buff grants you a additional" + HealBonus + " in the Heal!", eChatType.CT_Spell, eChatLoc.CL_ChatWindow); } GameSpellEffect EndEffect = SpellHandler.FindEffectOnTarget(playerTarget, "EfficientEndurance"); if (EndEffect != null) { double EndBonus = amount * ((int)EndEffect.Spell.Value * 0.01); //600 / 10 = 60end playerTarget.Endurance += (int)EndBonus; playerTarget.Out.SendMessage("Your Efficient Endurance buff grants you " + EndBonus + " Endurance from the Heal!", eChatType.CT_Spell, eChatLoc.CL_ChatWindow); } } GameSpellEffect flaskHeal = FindEffectOnTarget(target, "HealFlask"); if (flaskHeal != null) { amount += (int)((amount * flaskHeal.Spell.Value) * 0.01); } int heal = target.ChangeHealth(Caster, GameLiving.eHealthChangeType.Spell, amount); #region PVP DAMAGE long healedrp = 0; if (target.DamageRvRMemory > 0 && (target is NecromancerPet && ((target as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() != null || target is GamePlayer)) { healedrp = (long)Math.Max(heal, 0); target.DamageRvRMemory -= healedrp; } if (heal == 0) { if (Spell.Pulse == 0) { if (target == m_caster) { MessageToCaster("You are fully healed.", eChatType.CT_SpellResisted); } else { MessageToCaster(target.GetName(0, true) + " is fully healed.", eChatType.CT_SpellResisted); } } return(false); } if (m_caster is GamePlayer && target is NecromancerPet && ((target as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() != null || target is GamePlayer && healedrp > 0) { int POURCENTAGE_SOIN_RP = ServerProperties.Properties.HEAL_PVP_DAMAGE_VALUE_RP; // ...% de bonus RP pour les soins effectués if (m_spell.Pulse == 0 && m_caster.CurrentRegionID != 242 && // On Exclu zone COOP m_spell.SpellType.ToLower() != "spreadheal" && target != m_caster && m_spellLine.KeyName != GlobalSpellsLines.Item_Spells && m_spellLine.KeyName != GlobalSpellsLines.Potions_Effects && m_spellLine.KeyName != GlobalSpellsLines.Combat_Styles_Effect && m_spellLine.KeyName != GlobalSpellsLines.Reserved_Spells) { GamePlayer player = m_caster as GamePlayer; if (player != null) { long Bonus_RP_Soin = Convert.ToInt64((double)healedrp * POURCENTAGE_SOIN_RP / 100.0); if (Bonus_RP_Soin >= 1) { PlayerStatistics stats = player.Statistics as PlayerStatistics; if (stats != null) { stats.RPEarnedFromHitPointsHealed += (uint)Bonus_RP_Soin; stats.HitPointsHealed += (uint)healedrp; } player.GainRealmPoints(Bonus_RP_Soin, false); player.Out.SendMessage("Vous gagnez " + Bonus_RP_Soin.ToString() + " points de royaume pour avoir soigné un membre de votre royaume.", eChatType.CT_Important, eChatLoc.CL_SystemWindow); } } } } #endregion PVP DAMAGE if (m_caster == target) { MessageToCaster("You heal yourself for " + heal + " hit points.", eChatType.CT_Spell); if (heal < amount) { #region PVP DAMAGE if (target is NecromancerPet && ((target as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() != null || target is GamePlayer) { if (target.DamageRvRMemory > 0) { target.DamageRvRMemory = 0; //Remise a zéro compteur dommages/heal rps } } #endregion PVP DAMAGE MessageToCaster("You are fully healed.", eChatType.CT_Spell); } } else { MessageToCaster("You heal " + target.GetName(0, false) + " for " + heal + " hit points!", eChatType.CT_Spell); MessageToLiving(target, "You are healed by " + m_caster.GetName(0, false) + " for " + heal + " hit points.", eChatType.CT_Spell); if (heal < amount) { #region PVP DAMAGE if (target is NecromancerPet && ((target as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() != null || target is GamePlayer) { if (target.DamageRvRMemory > 0) { target.DamageRvRMemory = 0; //Remise a zéro compteur dommages/heal rps } } #endregion PVP DAMAGE MessageToCaster(target.GetName(0, true) + " is fully healed.", eChatType.CT_Spell); } if (heal > 0 && criticalvalue > 0) { MessageToCaster("Your heal criticals for an extra " + criticalvalue + " amount of hit points!", eChatType.CT_Spell); } } return(true); }
/// <summary> /// Heals hit points of one target and sends needed messages, no spell effects /// </summary> /// <param name="target"></param> /// <param name="amount">amount of hit points to heal</param> /// <returns>true if heal was done</returns> public virtual bool HealTarget(GameLiving target, int amount) { if (target == null || target.ObjectState != GameLiving.eObjectState.Active) { return(false); } // we can't heal people we can attack if (GameServer.ServerRules.IsAllowedToAttack(Caster, target, true)) { return(false); } if (!target.IsAlive) { MessageToCaster(target.GetName(0, true) + " is dead!", eChatType.CT_SpellResisted); return(false); } if (m_caster == target) { MessageToCaster("You cannot transfer life to yourself.", eChatType.CT_SpellResisted); return(false); } if (amount <= 0) //Player does not have enough health to transfer { MessageToCaster("You do not have enough health to transfer.", eChatType.CT_SpellResisted); return(false); } int heal = target.ChangeHealth(Caster, GameLiving.eHealthChangeType.Spell, amount); #region PVP DAMAGE long healedrp = 0; if (m_caster is NecromancerPet && ((m_caster as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() != null || m_caster is GamePlayer) { if (target is NecromancerPet && ((target as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() != null || target is GamePlayer) { if (target.DamageRvRMemory > 0) { healedrp = (long)Math.Max(heal, 0); target.DamageRvRMemory -= healedrp; } } } if (healedrp > 0 && m_caster != target && m_spellLine.KeyName != GlobalSpellsLines.Item_Spells && m_caster.CurrentRegionID != 242 && m_spell.Pulse == 0) // On Exclu zone COOP { GamePlayer joueur_a_considerer = (m_caster is NecromancerPet ? ((m_caster as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() : m_caster as GamePlayer); int POURCENTAGE_SOIN_RP = ServerProperties.Properties.HEAL_PVP_DAMAGE_VALUE_RP; // ...% de bonus RP pour les soins effectu�s long Bonus_RP_Soin = Convert.ToInt64((double)healedrp * POURCENTAGE_SOIN_RP / 100); if (Bonus_RP_Soin >= 1) { PlayerStatistics stats = joueur_a_considerer.Statistics as PlayerStatistics; if (stats != null) { stats.RPEarnedFromHitPointsHealed += (uint)Bonus_RP_Soin; stats.HitPointsHealed += (uint)healedrp; } joueur_a_considerer.GainRealmPoints(Bonus_RP_Soin, false); joueur_a_considerer.Out.SendMessage("Vous gagnez " + Bonus_RP_Soin.ToString() + " points de royaume pour avoir soign� un membre de votre royaume.", eChatType.CT_Important, eChatLoc.CL_SystemWindow); } } #endregion PVP DAMAGE if (heal == 0) { if (Spell.Pulse == 0) { MessageToCaster(target.GetName(0, true) + " is fully healed.", eChatType.CT_SpellResisted); } return(false); } MessageToCaster("You heal " + target.GetName(0, false) + " for " + heal + " hit points!", eChatType.CT_Spell); MessageToLiving(target, "You are healed by " + m_caster.GetName(0, false) + " for " + heal + " hit points.", eChatType.CT_Spell); if (heal < amount) { MessageToCaster(target.GetName(0, true) + " is fully healed.", eChatType.CT_Spell); } return(true); }
/// <summary> /// A heal generated by an item proc. /// </summary> /// <param name="target"></param> /// <param name="amount"></param> /// <returns></returns> public virtual bool ProcHeal(GameLiving target, int amount) { if (target == null || target.ObjectState != GameLiving.eObjectState.Active) { return(false); } // we can't heal people we can attack if (GameServer.ServerRules.IsAllowedToAttack(Caster, target, true)) { return(false); } if (!target.IsAlive) { return(false); } // no healing of keep components if (target is Keeps.GameKeepComponent || target is Keeps.GameKeepDoor) { return(false); } int heal = target.ChangeHealth(Caster, GameLiving.eHealthChangeType.Spell, amount); if (m_caster == target && heal > 0) { MessageToCaster("You heal yourself for " + heal + " hit points.", eChatType.CT_Spell); if (heal < amount) { MessageToCaster("You are fully healed.", eChatType.CT_Spell); #region PVP DAMAGE if (target is NecromancerPet && ((target as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() != null || target is GamePlayer) { if (target.DamageRvRMemory > 0) { target.DamageRvRMemory = 0; //Remise a zéro compteur dommages/heal rps } } #endregion PVP DAMAGE } } else if (heal > 0) { MessageToCaster("You heal " + target.GetName(0, false) + " for " + heal + " hit points!", eChatType.CT_Spell); MessageToLiving(target, "You are healed by " + m_caster.GetName(0, false) + " for " + heal + " hit points.", eChatType.CT_Spell); #region PVP DAMAGE if (heal < amount) { if (target is NecromancerPet && ((target as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() != null || target is GamePlayer) { if (target.DamageRvRMemory > 0) { target.DamageRvRMemory = 0; //Remise a zéro compteur dommages/heal rps } } } else { if (target is NecromancerPet && ((target as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() != null || target is GamePlayer) { if (target.DamageRvRMemory > 0) { target.DamageRvRMemory -= (long)Math.Max(heal, 0); } } } } #endregion PVP DAMAGE return(true); }
/// <summary> /// Heals hit points of one target and sends needed messages, no spell effects /// </summary> /// <param name="target"></param> /// <param name="amount">amount of hit points to heal</param> /// <returns>true if heal was done</returns> public virtual bool HealTarget(GameLiving target, int amount) { if (target==null || target.ObjectState!=GameLiving.eObjectState.Active) return false; // we can't heal people we can attack if (GameServer.ServerRules.IsAllowedToAttack(Caster, target, true)) return false; if (!target.IsAlive) { MessageToCaster(target.GetName(0, true) + " is dead!", eChatType.CT_SpellResisted); return false; } if (m_caster == target) { MessageToCaster("You cannot transfer life to yourself.", eChatType.CT_SpellResisted); return false; } if (amount <= 0) //Player does not have enough health to transfer { MessageToCaster("You do not have enough health to transfer.", eChatType.CT_SpellResisted); return false; } int heal = target.ChangeHealth(Caster, GameLiving.eHealthChangeType.Spell, amount); if (heal == 0) { if (Spell.Pulse == 0) { MessageToCaster(target.GetName(0, true)+" is fully healed.", eChatType.CT_SpellResisted); } return false; } MessageToCaster("You heal " + target.GetName(0, false) + " for " + heal + " hit points!", eChatType.CT_Spell); MessageToLiving(target, "You are healed by " + m_caster.GetName(0, false) + " for " + heal + " hit points.", eChatType.CT_Spell); if(heal < amount) MessageToCaster(target.GetName(0, true)+" is fully healed.", eChatType.CT_Spell); return true; }
/// <summary> /// Hurl a player into the air. /// </summary> /// <param name="target">The player to hurl into the air.</param> private void ThrowLiving(GameLiving target) { BroadcastMessage(String.Format("{0} is hurled into the air!", target.Name)); // Face the target, then push it 700 units up and 300 - 500 units backwards. TurnTo(target); Point3D targetPosition = PositionOfTarget(target, 700, Heading, Util.Random(300, 500)); if (target is GamePlayer) { target.MoveTo(target.CurrentRegionID, targetPosition.X, targetPosition.Y, targetPosition.Z, target.Heading); } else if (target is GameNPC) { (target as GameNPC).MoveInRegion(target.CurrentRegionID, targetPosition.X, targetPosition.Y, targetPosition.Z, target.Heading, true); target.ChangeHealth(this, eHealthChangeType.Spell, (int)(target.Health * -0.35)); } }
/// <summary> /// Heals hit points of one target and sends needed messages, no spell effects /// </summary> /// <param name="target"></param> /// <param name="amount">amount of hit points to heal</param> /// <returns>true if heal was done</returns> public virtual bool HealTarget(GameLiving target, double amount) { if (target == null || target.ObjectState != GameObject.eObjectState.Active) { return(false); } // we can't heal people we can attack if (GameServer.ServerRules.IsAllowedToAttack(Caster, target, true)) { return(false); } // no healing of keep components if (target is Keeps.GameKeepComponent || target is Keeps.GameKeepDoor) { return(false); } if (!target.IsAlive) { // "You cannot heal the dead!" sshot550.tga MessageToCaster($"{target.GetName(0, true)} is dead!", eChatType.CT_SpellResisted); return(false); } if (target is GamePlayer gamePlayer && gamePlayer.NoHelp && Caster is GamePlayer) { // player not grouped, anyone else // player grouped, different group if (gamePlayer.Group == null || ((GamePlayer)Caster).Group == null || ((GamePlayer)Caster).Group != gamePlayer.Group) { MessageToCaster("That player does not want assistance", eChatType.CT_SpellResisted); return(false); } } // moc heal decrease double mocFactor = 1.0; MasteryofConcentrationEffect moc = Caster.EffectList.GetOfType <MasteryofConcentrationEffect>(); if (moc != null) { if (Caster is GamePlayer playerCaster) { MasteryofConcentrationAbility ra = playerCaster.GetAbility <MasteryofConcentrationAbility>(); if (ra != null) { mocFactor = ra.GetAmountForLevel(ra.Level) / 100.0; } } amount = amount * mocFactor; } double criticalvalue = 0; int criticalchance = Caster.GetModified(eProperty.CriticalHealHitChance); double effectiveness = 0; if (Caster is GamePlayer player1) { effectiveness = player1.Effectiveness + Caster.GetModified(eProperty.HealingEffectiveness) * 0.01; } if (Caster is GameNPC) { effectiveness = 1.0; } // USE DOUBLE ! double cache = amount * effectiveness; amount = cache; if (Util.Chance(criticalchance)) { double minValue = amount / 10; double maxValue = amount / 2 + 1; criticalvalue = Util.RandomDouble() * (maxValue - minValue) + minValue; } amount += criticalvalue; if (target is GamePlayer playerTarget) { GameSpellEffect HealEffect = FindEffectOnTarget(playerTarget, "EfficientHealing"); if (HealEffect != null) { double HealBonus = amount * ((int)HealEffect.Spell.Value * 0.01); amount += (int)HealBonus; playerTarget.Out.SendMessage($"Your Efficient Healing buff grants you a additional{HealBonus} in the Heal!", eChatType.CT_Spell, eChatLoc.CL_ChatWindow); } GameSpellEffect EndEffect = FindEffectOnTarget(playerTarget, "EfficientEndurance"); if (EndEffect != null) { double EndBonus = amount * ((int)EndEffect.Spell.Value * 0.01); // 600 / 10 = 60end playerTarget.Endurance += (int)EndBonus; playerTarget.Out.SendMessage($"Your Efficient Endurance buff grants you {EndBonus} Endurance from the Heal!", eChatType.CT_Spell, eChatLoc.CL_ChatWindow); } } GameSpellEffect flaskHeal = FindEffectOnTarget(target, "HealFlask"); if (flaskHeal != null) { amount += (int)((amount * flaskHeal.Spell.Value) * 0.01); } // Scale spells that are cast by pets if (Caster is GamePet && !(Caster is NecromancerPet) && ServerProperties.Properties.PET_SCALE_SPELL_MAX_LEVEL > 0) { amount = ScalePetHeal(amount); } int heal = target.ChangeHealth(Caster, GameLiving.eHealthChangeType.Spell, (int)Math.Round(amount)); long healedrp = 0; if (target.DamageRvRMemory > 0 && (((target as NecromancerPet)?.Brain as IControlledBrain)?.GetPlayerOwner() != null || target is GamePlayer)) { healedrp = Math.Max(heal, 0); target.DamageRvRMemory -= healedrp; } if (heal == 0) { if (Spell.Pulse == 0) { if (target == Caster) { MessageToCaster("You are fully healed.", eChatType.CT_SpellResisted); } else { MessageToCaster($"{target.GetName(0, true)} is fully healed.", eChatType.CT_SpellResisted); } } return(false); } if (Caster is GamePlayer && ((target as NecromancerPet)?.Brain as IControlledBrain)?.GetPlayerOwner() != null || target is GamePlayer && healedrp > 0) { int POURCENTAGE_SOIN_RP = ServerProperties.Properties.HEAL_PVP_DAMAGE_VALUE_RP; // ...% de bonus RP pour les soins effectués if (Spell.Pulse == 0 && Caster.CurrentRegionID != 242 && // On Exclu zone COOP Spell.SpellType.ToLower() != "spreadheal" && target != Caster && SpellLine.KeyName != GlobalSpellsLines.Item_Spells && SpellLine.KeyName != GlobalSpellsLines.Potions_Effects && SpellLine.KeyName != GlobalSpellsLines.Combat_Styles_Effect && SpellLine.KeyName != GlobalSpellsLines.Reserved_Spells) { if (Caster is GamePlayer player) { long Bonus_RP_Soin = Convert.ToInt64((double)healedrp * POURCENTAGE_SOIN_RP / 100.0); if (Bonus_RP_Soin >= 1) { if (player.Statistics is PlayerStatistics stats) { stats.RPEarnedFromHitPointsHealed += (uint)Bonus_RP_Soin; stats.HitPointsHealed += (uint)healedrp; } player.GainRealmPoints(Bonus_RP_Soin, false); player.Out.SendMessage($"You earn {Bonus_RP_Soin} Realm Points for healing a member of your realm.", eChatType.CT_Important, eChatLoc.CL_SystemWindow); } } } } if (Caster == target) { MessageToCaster($"You heal yourself for {heal} hit points.", eChatType.CT_Spell); if (heal < amount) { if (((target as NecromancerPet)?.Brain as IControlledBrain)?.GetPlayerOwner() != null || target is GamePlayer) { if (target.DamageRvRMemory > 0) { target.DamageRvRMemory = 0; // Remise a zéro compteur dommages/heal rps } } MessageToCaster("You are fully healed.", eChatType.CT_Spell); } } else { MessageToCaster($"You heal {target.GetName(0, false)} for {heal} hit points!", eChatType.CT_Spell); MessageToLiving(target, $"You are healed by {Caster.GetName(0, false)} for {heal} hit points.", eChatType.CT_Spell); if (heal < amount) { if (((target as NecromancerPet)?.Brain as IControlledBrain)?.GetPlayerOwner() != null || target is GamePlayer) { if (target.DamageRvRMemory > 0) { target.DamageRvRMemory = 0; // Remise a zéro compteur dommages/heal rps } } MessageToCaster($"{target.GetName(0, true)} is fully healed.", eChatType.CT_Spell); } if (heal > 0 && criticalvalue > 0) { MessageToCaster($"Your heal criticals for an extra {criticalvalue} amount of hit points!", eChatType.CT_Spell); } } return(true); }