本文整理汇总了C#中GamePlayer.DisableSkill方法的典型用法代码示例。如果您正苦于以下问题:C# GamePlayer.DisableSkill方法的具体用法?C# GamePlayer.DisableSkill怎么用?C# GamePlayer.DisableSkill使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GamePlayer
的用法示例。
在下文中一共展示了GamePlayer.DisableSkill方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
/// <summary>
/// Action
/// </summary>
/// <param name="living"></param>
public override void Execute(GameLiving living)
{
if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;
if (living is GamePlayer)
{
player = living as GamePlayer;
if (player.TargetObject == null)
{
player.Out.SendMessage("You need a target for this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
player.DisableSkill(this, 3 * 1000);
return;
}
if (!(player.TargetObject is GamePlayer))
{
player.Out.SendMessage("This work only on players!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
player.DisableSkill(this, 3 * 1000);
return;
}
if (!GameServer.ServerRules.IsAllowedToAttack(player, (GamePlayer)player.TargetObject, true))
{
player.Out.SendMessage("This work only on enemies!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
player.DisableSkill(this, 3 * 1000);
return;
}
if ( !player.IsWithinRadius( player.TargetObject, SpellRange ) )
{
player.Out.SendMessage(player.TargetObject + " is too far away!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
player.DisableSkill(this, 3 * 1000);
return;
}
foreach (GamePlayer radiusPlayer in player.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
{
if (radiusPlayer == player) radiusPlayer.Out.SendMessage("You cast " + this.Name + "!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
else radiusPlayer.Out.SendMessage(player.Name + " casts a spell!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
radiusPlayer.Out.SendSpellCastAnimation(player, 7059, 0);
}
if (player.RealmAbilityCastTimer != null)
{
player.RealmAbilityCastTimer.Stop();
player.RealmAbilityCastTimer = null;
player.Out.SendMessage("You cancel your Spell!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
}
targetPlayer = player.TargetObject as GamePlayer;
//[StephenxPimentel]
//1.108 - this ability is now instant cast.
EndCast();
}
}
示例2: Execute
/// <summary>
/// Execute dirtytricks ability
/// </summary>
/// <param name="ab">The used ability</param>
/// <param name="player">The player that used the ability</param>
public void Execute(Ability ab, GamePlayer player)
{
if (player == null)
{
if (log.IsWarnEnabled)
log.Warn("Could not retrieve player in DirtyTricksAbilityHandler.");
return;
}
if (!player.IsAlive)
{
player.Out.SendMessage("You are dead and can't use that ability!", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsMezzed)
{
player.Out.SendMessage("You cannot use this while Mezzed!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsStunned)
{
player.Out.SendMessage("You cannot use this while Stunned!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsSitting)
{
player.Out.SendMessage("You must be standing to use this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
player.DisableSkill(ab, REUSE_TIMER);
DirtyTricksEffect dt = new DirtyTricksEffect(DURATION * 1000);
dt.Start(player);
}
示例3: Execute
public override void Execute(GameLiving living)
{
if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;
m_caster = living as GamePlayer;
if (m_caster == null)
return;
if (m_caster.TargetObject == null)
{
m_caster.Out.SendMessage("You need a target for this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
m_caster.DisableSkill(this, 3 * 1000);
return;
}
if ( !m_caster.IsWithinRadius( m_caster.TargetObject, (int)( 1500 * m_caster.GetModified(eProperty.SpellRange) * 0.01 ) ) )
{
m_caster.Out.SendMessage(m_caster.TargetObject + " is too far away.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
return;
}
switch (Level)
{
case 1: m_dmgValue = 200; break;
case 2: m_dmgValue = 500; break;
case 3: m_dmgValue = 750; break;
default: return;
}
foreach (GamePlayer i_player in m_caster.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
{
if (i_player == m_caster)
{
i_player.MessageToSelf("You cast " + this.Name + "!", eChatType.CT_Spell);
}
else
{
i_player.MessageFromArea(m_caster, m_caster.Name + " casts a spell!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
}
i_player.Out.SendSpellCastAnimation(m_caster, 7025, 20);
}
if (m_caster.RealmAbilityCastTimer != null)
{
m_caster.RealmAbilityCastTimer.Stop();
m_caster.RealmAbilityCastTimer = null;
m_caster.Out.SendMessage("You cancel your Spell!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
}
m_caster.RealmAbilityCastTimer = new RegionTimer(m_caster);
m_caster.RealmAbilityCastTimer.Callback = new RegionTimerCallback(EndCast);
m_caster.RealmAbilityCastTimer.Start(2000);
}
示例4: Execute
/// <summary>
/// Action
/// </summary>
/// <param name="living"></param>
public void Execute(Ability ab, GamePlayer player)
{
if (!player.IsAlive || player.IsSitting || player.IsMezzed || player.IsStunned)
return;
if (player != null)
{
player.Out.SendSpellEffectAnimation(player, player, 7060, 0, false, 1);
//SendCasterSpellEffectAndCastMessage(player, 7060, true);
RemedyEffect effect = new RemedyEffect();
effect.Start(player);
player.DisableSkill(ab, 300 * 1000);
}
}
示例5: Execute
/// <summary>
/// Executes the stealth ability
/// </summary>
/// <param name="ab"></param>
/// <param name="player"></param>
public void Execute(Ability ab, GamePlayer player)
{
#region Check
if (!player.IsStealthed)
{
if (player.IsMezzed)
{
player.Out.SendMessage("You can't use camouflage while mesmerized!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsStunned)
{
player.Out.SendMessage("You can't use camouflage while stunned!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
player.Out.SendMessage("You can't use camouflage while not stealthed!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (!player.IsAlive)
{
player.Out.SendMessage("You can't use camouflage when dead!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
#endregion Check
CamouflageEffect camouflage = player.EffectList.GetOfType<CamouflageEffect>();
if (camouflage != null)
{
camouflage.Cancel(false);
return;
}
long changeTime = player.CurrentRegion.Time - player.LastAttackTickPvP;
if (player.CurrentRegion.IsRvR && changeTime < DISABLE_DURATION)
{
player.Out.SendMessage("You must wait " + ((DISABLE_DURATION - changeTime) / 1000) + " more second to attempt to use camouflage!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
player.DisableSkill(ab, DISABLE_DURATION);
new CamouflageEffect().Start(player);
}
示例6: Execute
public const int DURATION = 30 * 1000; // 30 seconds
public void Execute(Ability ab, GamePlayer player)
{
if (player == null)
{
if (log.IsWarnEnabled)
log.Warn("Could not retrieve player in StagAbilityHandler.");
return;
}
if (!player.IsAlive)
{
player.Out.SendMessage("You cannot use this while Dead!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsMezzed)
{
player.Out.SendMessage("You cannot use this while Mezzed!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsStunned)
{
player.Out.SendMessage("You cannot use this while Stunned!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsSitting)
{
player.Out.SendMessage("You must be standing to use this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
//Cancel old stag effects on player
StagEffect stag = player.EffectList.GetOfType<StagEffect>();
if (stag != null)
{
player.Out.SendMessage("That ability is already active, wait until it expires.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
player.DisableSkill(ab, REUSE_TIMER);
new StagEffect(ab.Level).Start(player);
}
示例7: Execute
public void Execute(Ability ab, GamePlayer player)
{
if (player == null)
{
if (log.IsWarnEnabled)
log.Warn("Could not retrieve player in TripleWieldAbilityHandler.");
return;
}
if (!player.IsAlive)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseDead"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsMezzed)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseMezzed"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsStunned)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseStunned"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsSitting)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseStanding"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
TripleWieldEffect tw = player.EffectList.GetOfType<TripleWieldEffect>();
if (tw != null)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseAlreadyActive"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
TripleWieldEffect twe = new TripleWieldEffect(DURATION * 1000);
twe.Start(player);
player.DisableSkill(ab, REUSE_TIMER * 1000);
}
示例8: Execute
public void Execute(Ability ab, GamePlayer player)
{
if (player == null)
{
if (log.IsWarnEnabled)
log.Warn("Could not retrieve player in TripleWieldAbilityHandler.");
return;
}
if (!player.IsAlive)
{
player.Out.SendMessage("You cannot use this while Dead!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsMezzed)
{
player.Out.SendMessage("You cannot use this while Mezzed!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsStunned)
{
player.Out.SendMessage("You cannot use this while Stunned!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsSitting)
{
player.Out.SendMessage("You must be standing to use this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
TripleWieldEffect tw = player.EffectList.GetOfType<TripleWieldEffect>();
if (tw != null)
{
player.Out.SendMessage("That ability is already active, wait until it expires.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
TripleWieldEffect twe = new TripleWieldEffect(DURATION * 1000);
twe.Start(player);
player.DisableSkill(ab, REUSE_TIMER * 1000);
}
示例9: Execute
public void Execute(Ability ab, GamePlayer player)
{
if (player == null)
{
if (log.IsWarnEnabled)
log.Warn("Could not retrieve player in StagAbilityHandler.");
return;
}
if (!player.IsAlive)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseDead"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsMezzed)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseMezzed"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsStunned)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseStunned"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsSitting)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseStanding"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
//Cancel old stag effects on player
StagEffect stag = player.EffectList.GetOfType<StagEffect>();
if (stag != null)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseAlreadyActive"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
player.DisableSkill(ab, REUSE_TIMER);
new StagEffect(ab.Level).Start(player);
}
示例10: Execute
/// <summary>
/// Execute the ability
/// </summary>
/// <param name="ab">The ability executed</param>
/// <param name="player">The player that used the ability</param>
public void Execute(Ability ab, GamePlayer player)
{
if (player == null)
{
if (log.IsWarnEnabled)
log.Warn("Could not retrieve player in BerserkAbilityHandler.");
return;
}
if (!player.IsAlive)
{
player.Out.SendMessage("You cannot use this while Dead!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsMezzed)
{
player.Out.SendMessage("You cannot use this while Mezzed!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsStunned)
{
player.Out.SendMessage("You cannot use this while Stunned!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsSitting)
{
player.Out.SendMessage("You must be standing to use this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
//Cancel old berserk effects on player
BerserkEffect berserk = player.EffectList.GetOfType<BerserkEffect>();
if (berserk!=null)
{
berserk.Cancel(false);
return;
}
player.DisableSkill(ab, REUSE_TIMER);
new BerserkEffect().Start(player);
}
示例11: Execute
public override void Execute(GameLiving living)
{
if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;
caster = living as GamePlayer;
if (caster == null)
return;
if (caster.TargetObject == null)
{
caster.Out.SendMessage("You need a target for this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
caster.DisableSkill(this, 3 * 1000);
return;
}
if (!caster.TargetInView)
{
caster.Out.SendMessage(caster.TargetObject.Name + " is not in view.", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
caster.DisableSkill(this, 3 * 1000);
return;
}
if (!caster.IsWithinRadius( caster.TargetObject, 1875 ))
{
caster.Out.SendMessage(caster.TargetObject.Name + " is too far away.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
caster.DisableSkill(this, 3 * 1000);
return;
}
if (m_expireTimerID != null && m_expireTimerID.IsAlive)
{
caster.Out.SendMessage("You are already casting this ability.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
caster.DisableSkill(this, 3 * 1000);
return;
}
if(ServerProperties.Properties.USE_NEW_ACTIVES_RAS_SCALING)
{
switch (Level)
{
case 1: dmgValue = 150; duration = 10000; break;
case 2: dmgValue = 275; duration = 15000; break;
case 3: dmgValue = 400; duration = 20000; break;
case 4: dmgValue = 500; duration = 25000; break;
case 5: dmgValue = 600; duration = 30000; break;
default: return;
}
}
//150 dam/10 sec || 400/20 || 600/30
switch (Level)
{
case 1: dmgValue = 150; duration = 10000; break;
case 2: dmgValue = 400; duration = 20000; break;
case 3: dmgValue = 600; duration = 30000; break;
default: return;
}
#region resist and det
GameLiving m_target = caster.TargetObject as GameLiving;
int primaryResistModifier = m_target.GetResist(eDamageType.Spirit);
int secondaryResistModifier = m_target.SpecBuffBonusCategory[(int)eProperty.Resist_Spirit];
int rootdet = ((m_target.GetModified(eProperty.SpeedDecreaseDurationReduction) - 100) * -1);
int ResistModifier = 0;
ResistModifier += (int)((dmgValue * (double)primaryResistModifier) * -0.01);
ResistModifier += (int)((dmgValue + (double)ResistModifier) * (double)secondaryResistModifier * -0.01);
if (m_target is GamePlayer)
{
dmgValue += ResistModifier;
}
if (m_target is GameNPC)
{
dmgValue += ResistModifier;
}
int rootmodifier = 0;
rootmodifier += (int)((duration * (double)primaryResistModifier) * -0.01);
rootmodifier += (int)((duration + (double)primaryResistModifier) * (double)secondaryResistModifier * -0.01);
rootmodifier += (int)((duration + (double)rootmodifier) * (double)rootdet * -0.01);
duration += rootmodifier;
if (duration < 1)
duration = 1;
#endregion
foreach (GamePlayer i_player in caster.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
{
if (i_player == caster)
{
i_player.MessageToSelf("You cast " + this.Name + "!", eChatType.CT_Spell);
}
else
{
i_player.MessageFromArea(caster, caster.Name + " casts a spell!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
}
//.........这里部分代码省略.........
示例12: Execute
//.........这里部分代码省略.........
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseStunned"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsSitting)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseStanding"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.TargetObject == null)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseNoTarget"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (!(player.TargetObject is GamePlayer || player.TargetObject is GameKeepGuard))
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.Flurry.TargetNotPlayerOrGuards"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (!GameServer.ServerRules.IsAllowedToAttack(player, (GameLiving)player.TargetObject, true))
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotAttackTarget", player.TargetObject.Name), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (!player.IsObjectInFront(player.TargetObject, 180) || !player.TargetInView)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotSeeTarget", player.TargetObject.Name), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (!player.IsWithinRadius(player.TargetObject, 135)) //Didn't use AttackRange cause of the fact that player could use a Bow
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.TargetIsWithinRadius"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.TargetObject is GamePlayer && SpellHandler.FindEffectOnTarget((GamePlayer)player.TargetObject, "Phaseshift") != null)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.TargetIsPhaseshifted", player.TargetObject.Name), eChatType.CT_Missed, eChatLoc.CL_SystemWindow);
return;
}
if(player.TargetObject is GamePlayer)
{
SputinsLegacyEffect SputinLegacy = (player.TargetObject as GamePlayer).EffectList.GetOfType<SputinsLegacyEffect>();
if(SputinLegacy != null)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.TargetIsUnderSputinLegacy", player.TargetObject.Name), eChatType.CT_Missed, eChatLoc.CL_SystemWindow);
return;
}
}
#endregion
GameLiving target = (GameLiving)player.TargetObject;
int damage = 0;
int specc = (player.CharacterClass is PlayerClass.ClassBlademaster) ?
player.GetModifiedSpecLevel(Specs.Celtic_Dual) : player.GetModifiedSpecLevel(Specs.Dual_Wield);
//damage = base HP / 100 * DWspec / 2.7 that would be the original calculation
if (target is GamePlayer)
{
damage = (int)(target.MaxHealth / 100 * specc / 4.5); // prev 3.5
}
else
{ damage = (int)(target.MaxHealth / 100 * specc / 4.6); } // prev 3.6
#region Resists
int primaryResistModifier = target.GetResist(eDamageType.Slash);
//Using the resist BuffBonusCategory2 - its unused in ResistCalculator
int secondaryResistModifier = target.SpecBuffBonusCategory[(int)eProperty.Resist_Slash];
int resistModifier = 0;
//primary resists
resistModifier += (int)(damage * (double)primaryResistModifier * -0.01);
//secondary resists
resistModifier += (int)((damage + (double)resistModifier) * (double)secondaryResistModifier * -0.01);
//apply resists
damage += resistModifier;
#endregion
//flurry is slash damage
target.TakeDamage(player, eDamageType.Slash, damage, 0);
GameSpellEffect mez = SpellHandler.FindEffectOnTarget(target, "Mesmerize");
if (mez != null)
mez.Cancel(false);
//sending spell effect
foreach (GamePlayer effPlayer in target.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
effPlayer.Out.SendSpellEffectAnimation(player, target, 7103, 0, false, 0x01);
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.Flurry.YouHit", target.GetName(0, false), damage), eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
if (target is GamePlayer)
(target as GamePlayer).Out.SendMessage(LanguageMgr.GetTranslation((target as GamePlayer).Client, "Skill.Ability.Flurry.HitYou", player.Name, damage), eChatType.CT_Damaged, eChatLoc.CL_SystemWindow);
player.LastAttackTickPvP = player.CurrentRegion.Time;
target.LastAttackedByEnemyTickPvP = target.CurrentRegion.Time;
player.DisableSkill(ab, REUSE_TIMER);
}
示例13: Execute
/// <summary>
/// Executes the ability
/// </summary>
/// <param name="ab">The ability used</param>
/// <param name="player">The player that used the ability</param>
public void Execute(Ability ab, GamePlayer player)
{
if (player == null)
{
if (log.IsWarnEnabled)
log.Warn("Could not retrieve player in InterceptAbilityHandler.");
return;
}
GameObject targetObject = player.TargetObject;
if (targetObject == null)
{
foreach (InterceptEffect intercept in player.EffectList.GetAllOfType<InterceptEffect>())
{
if (intercept.InterceptSource != player)
continue;
intercept.Cancel(false);
}
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.Intercept.CancelTargetNull"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
// Only attacks on other players may be intercepted.
// You cannot intercept attacks on yourself
Group group = player.Group;
GamePlayer interceptTarget = targetObject as GamePlayer;
if (interceptTarget == null || group == null || !group.IsInTheGroup(interceptTarget) || interceptTarget == player)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.Intercept.CannotUse.NotInGroup"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
// check if someone is already intercepting for that target
foreach (InterceptEffect intercept in interceptTarget.EffectList.GetAllOfType<InterceptEffect>())
{
if (intercept.InterceptTarget != interceptTarget)
continue;
if (intercept.InterceptSource != player && !(intercept.InterceptSource is GameNPC))
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.Intercept.CannotUse.InterceptTargetAlreadyInterceptedEffect", intercept.InterceptSource.GetName(0, true), intercept.InterceptTarget.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
}
// cancel all intercepts by this player
foreach (InterceptEffect intercept in player.EffectList.GetAllOfType<InterceptEffect>())
{
if (intercept.InterceptSource != player)
continue;
intercept.Cancel(false);
}
player.DisableSkill(ab, REUSE_TIMER);
new InterceptEffect().Start(player, interceptTarget);
}
示例14: Execute
/// <summary>
/// Executes the ability
/// </summary>
/// <param name="ab">The ability used</param>
/// <param name="player">The player that used the ability</param>
public void Execute(Ability ab, GamePlayer player)
{
if (player == null)
{
if (log.IsWarnEnabled)
log.Warn("Could not retrieve player in InterceptAbilityHandler.");
return;
}
GameObject targetObject = player.TargetObject;
if (targetObject == null)
{
foreach (InterceptEffect intercept in player.EffectList.GetAllOfType<InterceptEffect>())
{
if (intercept.InterceptSource != player)
continue;
intercept.Cancel(false);
}
player.Out.SendMessage("You are no longer attempting to intercept attacks for anyone.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
// Only attacks on other players may be intercepted.
// You cannot intercept attacks on yourself
Group group = player.Group;
GamePlayer interceptTarget = targetObject as GamePlayer;
if (interceptTarget == null || group == null || !group.IsInTheGroup(interceptTarget) || interceptTarget == player)
{
player.Out.SendMessage("You can only take intercept attacks for players in your group!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
// check if someone is already intercepting for that target
foreach (InterceptEffect intercept in interceptTarget.EffectList.GetAllOfType<InterceptEffect>())
{
if (intercept.InterceptTarget != interceptTarget)
continue;
if (intercept.InterceptSource != player && !(intercept.InterceptSource is GameNPC))
{
player.Out.SendMessage(string.Format("{0} is already intercepting for {1}.", intercept.InterceptSource.GetName(0, true), intercept.InterceptTarget.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
}
// cancel all intercepts by this player
foreach (InterceptEffect intercept in player.EffectList.GetAllOfType<InterceptEffect>())
{
if (intercept.InterceptSource != player)
continue;
intercept.Cancel(false);
}
player.DisableSkill(ab, REUSE_TIMER);
new InterceptEffect().Start(player, interceptTarget);
}
示例15: Execute
/// <summary>
/// Execute dirtytricks ability
/// </summary>
/// <param name="ab">The used ability</param>
/// <param name="player">The player that used the ability</param>
public void Execute(Ability ab, GamePlayer player)
{
if (player == null)
{
if (log.IsWarnEnabled)
log.Warn("Could not retrieve player in DirtyTricksAbilityHandler.");
return;
}
if (!player.IsAlive)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseDead"), eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsMezzed)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseMezzed"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsStunned)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseStunned"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsSitting)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseStanding"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
player.DisableSkill(ab, REUSE_TIMER);
DirtyTricksEffect dt = new DirtyTricksEffect(DURATION * 1000);
dt.Start(player);
}