本文整理汇总了C#中GameLiving.ChangeHealth方法的典型用法代码示例。如果您正苦于以下问题:C# GameLiving.ChangeHealth方法的具体用法?C# GameLiving.ChangeHealth怎么用?C# GameLiving.ChangeHealth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameLiving
的用法示例。
在下文中一共展示了GameLiving.ChangeHealth方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
/// <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);
}
示例2: Execute
/// <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);
}
示例3: ThrowLiving
/// <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));
}
}
示例4: OnDirectEffect
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;
}
}
}
示例5: ProcHeal
/// <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;
}
示例6: HealTarget
/// <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;
//.........这里部分代码省略.........
示例7: HealTarget
/// <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;
}
示例8: HealTarget
/// <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;
}
示例9: ProcHeal
/// <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;
}
示例10: HealTarget
/// <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)
{
//.........这里部分代码省略.........