本文整理汇总了C#中DOL.GS.Effects.GameSpellEffect.Cancel方法的典型用法代码示例。如果您正苦于以下问题:C# GameSpellEffect.Cancel方法的具体用法?C# GameSpellEffect.Cancel怎么用?C# GameSpellEffect.Cancel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOL.GS.Effects.GameSpellEffect
的用法示例。
在下文中一共展示了GameSpellEffect.Cancel方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnEffectExpires
/// Effect expiring (duration spells only).
/// <returns>Immunity duration in milliseconds.</returns>
public override int OnEffectExpires(GameSpellEffect effect, bool noMessages)
{
GamePlayer player = effect.Owner as GamePlayer;
if (player != null)
{
effect.Cancel(false);
player.Model = player.CreationModel;
GameEventMgr.RemoveHandler((GamePlayer)effect.Owner, GamePlayerEvent.RegionChanged, new DOLEventHandler(OnZone));
}
return 0;
}
示例2: OnEffectPulse
public override void OnEffectPulse(GameSpellEffect effect)
{
if (!m_caster.IsAlive || !effect.Owner.IsAlive || m_caster.Mana < Spell.PulsePower || !m_caster.IsWithinRadius(effect.Owner, (int)(Spell.Range * m_caster.GetModified(eProperty.SpellRange) * 0.01)) || m_caster.IsMezzed || m_caster.IsStunned || (m_caster.TargetObject is GameLiving ? effect.Owner != m_caster.TargetObject as GameLiving : true))
{
effect.Cancel(false);
return;
}
base.OnEffectPulse(effect);
SendEffectAnimation(effect.Owner, 0, false, 1);
// An acidic cloud surrounds you!
MessageToLiving(effect.Owner, Spell.Message1, eChatType.CT_Spell);
// {0} is surrounded by an acidic cloud!
Message.SystemToArea(effect.Owner, Util.MakeSentence(Spell.Message2, effect.Owner.GetName(0, false)), eChatType.CT_YouHit, effect.Owner);
OnDirectEffect(effect.Owner, effect.Effectiveness);
}
示例3: OnEffectStart
public override void OnEffectStart(GameSpellEffect effect)
{
base.OnEffectStart(effect);
double playerAF = 0;
double bonusAF = 0;
double bonusHP = 0;
if (effect == null || effect.Owner == null)
{
effect.Cancel(false);
return;
}
foreach (InventoryItem item in effect.Owner.Inventory.EquippedItems)
{
if (item.Object_Type >= (int)eObjectType._FirstArmor && item.Object_Type <= (int)eObjectType._LastArmor)
{
playerAF += item.DPS_AF;
}
}
playerAF += effect.Owner.GetModifiedFromItems(eProperty.ArmorFactor);
if (m_spell.Value < 0)
{
bonusAF = ((m_spell.Value * -1) * playerAF) / 100;
bonusHP = ((m_spell.Value * -1) * effect.Owner.MaxHealth) / 100;
}
else
{
bonusAF = m_spell.Value;
bonusHP = m_spell.Value;
}
GameLiving living = effect.Owner as GameLiving;
living.TempProperties.setProperty("BONUS_HP", bonusHP);
living.TempProperties.setProperty("BONUS_AF", bonusAF);
living.AbilityBonus[(int)eProperty.MaxHealth] += (int)bonusHP;
living.ItemBonus[(int)eProperty.ArmorFactor] += (int)bonusAF;
SendUpdates(effect.Owner);
}
示例4: OnEffectPulse
public override void OnEffectPulse(GameSpellEffect effect)
{
if (storm == null || storm.ObjectState == GameObject.eObjectState.Deleted)
{
effect.Cancel(false);
return;
}
if (tempest == null || s == null)
{
return;
}
int ranged = storm.GetDistanceTo(new Point3D((int)effect.Owner.X, (int)effect.Owner.Y, (int)effect.Owner.Z));
if (ranged > 3000) return;
if (s.Name == "Dazzling Array")
{
foreach (GamePlayer player in storm.GetPlayersInRadius(sRadius))
{
tempest = ScriptMgr.CreateSpellHandler(m_caster, s, sl);
if ((player.IsAlive) && (GameServer.ServerRules.IsSameRealm(storm, player, true))) tempest.StartSpell((GameLiving)player);
}
}
else
{
foreach (GamePlayer player in storm.GetPlayersInRadius(sRadius))
{
tempest = ScriptMgr.CreateSpellHandler(m_caster, s, sl);
if ((player.IsAlive) && (GameServer.ServerRules.IsAllowedToAttack(storm, player, true))) tempest.StartSpell((GameLiving)player);
}
}
}
示例5: OnEffectStart
public override void OnEffectStart(GameSpellEffect effect)
{
base.OnEffectStart(effect);
m_effect = effect;
if (effect.Owner == null || !effect.Owner.IsAlive)
return;
if ((effect.Owner is GamePlayer))
{
GamePlayer casterPlayer = effect.Owner as GamePlayer;
if (casterPlayer.GroundTarget != null && casterPlayer.GroundTargetInView)
{
GameEventMgr.AddHandler(casterPlayer, GamePlayerEvent.Moving, new DOLEventHandler(PlayerMoves));
GameEventMgr.AddHandler(warder, GameLivingEvent.Dying, new DOLEventHandler(BattleWarderDie));
GameEventMgr.AddHandler(casterPlayer, GamePlayerEvent.CastStarting, new DOLEventHandler(PlayerMoves));
GameEventMgr.AddHandler(casterPlayer, GamePlayerEvent.AttackFinished, new DOLEventHandler(PlayerMoves));
warder.X = casterPlayer.GroundTarget.X;
warder.Y = casterPlayer.GroundTarget.Y;
warder.Z = casterPlayer.GroundTarget.Z;
warder.AddBrain(new MLBrain());
warder.AddToWorld();
}
else
{
MessageToCaster("Your area target is out of range. Set a closer ground position.", eChatType.CT_SpellResisted);
effect.Cancel(false);
}
}
}
示例6: OnEffectPulse
/// <summary>
/// When an applied effect pulses
/// duration spells only
/// </summary>
/// <param name="effect"></param>
public virtual void OnEffectPulse(GameSpellEffect effect)
{
if (effect.Owner.IsAlive == false)
{
effect.Cancel(false);
}
}
示例7: OnEffectPulse
public override void OnEffectPulse(GameSpellEffect effect)
{
if (mine == null || mine.ObjectState == GameObject.eObjectState.Deleted)
{
effect.Cancel(false);
return;
}
if (trap == null) return;
bool wasstealthed = ((GamePlayer)Caster).IsStealthed;
foreach (GameNPC npc in mine.GetNPCsInRadius((ushort)s.Range))
{
if (npc is GameSiegeWeapon && npc.IsAlive && GameServer.ServerRules.IsAllowedToAttack(Caster, npc, true))
{
trap.StartSpell((GameLiving)npc);
if (!Unstealth) ((GamePlayer)Caster).Stealth(wasstealthed);
return;
}
}
}
示例8: OnEffectStart
public override void OnEffectStart(GameSpellEffect effect)
{
if (effect.Owner == null) return;
if (!effect.Owner.IsAlive || effect.Owner.ObjectState != GameLiving.eObjectState.Active) return;
//SendEffectAnimation(effect.Owner, 0, false, 1); //send the effect
if (effect.Owner is GamePlayer)
{
/*
*Q: What does the confusion spell do against players?
*A: According to the magic man, “Confusion against a player interrupts their current action, whether it's a bow shot or spellcast.
*/
if (Spell.Value < 0 || Util.Chance(Convert.ToInt32(Math.Abs(Spell.Value))))
{
//Spell value below 0 means it's 100% chance to confuse.
GamePlayer player = effect.Owner as GamePlayer;
player.StartInterruptTimer(player.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
}
effect.Cancel(false);
}
else if (effect.Owner is GameNPC)
{
//check if we should do anything at all.
bool doConfuse = (Spell.Value < 0 || Util.Chance(Convert.ToInt32(Spell.Value)));
if (!doConfuse)
return;
bool doAttackFriend = Spell.Value < 0 && Util.Chance(Convert.ToInt32(Math.Abs(Spell.Value)));
GameNPC npc = effect.Owner as GameNPC;
npc.IsConfused = true;
if (log.IsDebugEnabled)
log.Debug("CONFUSION: " + npc.Name + " was confused(true," + doAttackFriend.ToString() + ")");
if (npc is GamePet && npc.Brain != null && (npc.Brain as IControlledBrain) != null)
{
//it's a pet.
GamePlayer playerowner = (npc.Brain as IControlledBrain).GetPlayerOwner();
if (playerowner != null && playerowner.CharacterClass.ID == (int)eCharacterClass.Theurgist)
{
//Theurgist pets die.
npc.Die(Caster);
effect.Cancel(false);
return;
}
}
targetList.Clear();
foreach (GamePlayer target in npc.GetPlayersInRadius(1000))
{
if (doAttackFriend)
targetList.Add(target);
else
{
//this should prevent mobs from attacking friends.
if (GameServer.ServerRules.IsAllowedToAttack(npc, target, true))
targetList.Add(target);
}
}
foreach (GameNPC target in npc.GetNPCsInRadius(1000))
{
//don't agro yourself.
if (target == npc)
continue;
if (doAttackFriend)
targetList.Add(target);
else
{
//this should prevent mobs from attacking friends.
if (GameServer.ServerRules.IsAllowedToAttack(npc, target, true) && !GameServer.ServerRules.IsSameRealm(npc, target, true))
targetList.Add(target);
}
}
//targetlist should be full, start effect pulse.
if (targetList.Count > 0)
{
npc.StopAttack();
npc.StopCurrentSpellcast();
GameLiving target = targetList[Util.Random(targetList.Count - 1)] as GameLiving;
npc.StartAttack(target);
}
}
}
示例9: OnEffectPulse
/// <summary>
/// When an applied effect pulses
/// duration spells only
/// </summary>
/// <param name="effect"></param>
public override void OnEffectPulse(GameSpellEffect effect)
{
base.OnEffectPulse(effect);
MessageToLiving(effect.Owner, Spell.Message1, eChatType.CT_YouWereHit);
Message.SystemToArea(effect.Owner, Util.MakeSentence(Spell.Message2, effect.Owner.GetName(0, false)), eChatType.CT_YouHit, effect.Owner);
int bleedValue = effect.Owner.TempProperties.getProperty<int>(BLEED_VALUE_PROPERTY);
AttackData ad = CalculateDamageToTarget( effect.Owner, 1.0 );
SendDamageMessages(ad);
// attacker must be null, attack result is 0x0A
foreach(GamePlayer player in ad.Target.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
{
player.Out.SendCombatAnimation(null, ad.Target, 0, 0, 0, 0, 0x0A, ad.Target.HealthPercent);
}
// send animation before dealing damage else dead livings show no animation
ad.Target.OnAttackedByEnemy(ad);
ad.Attacker.DealDamage(ad);
if (--bleedValue <= 0 || !effect.Owner.IsAlive)
effect.Cancel(false);
else effect.Owner.TempProperties.setProperty(BLEED_VALUE_PROPERTY, bleedValue);
}
示例10: OnEffectStart
/// Effect starting.
/// <param name="effect"></param>
public override void OnEffectStart(GameSpellEffect effect)
{
GamePlayer player = effect.Owner as GamePlayer;
if (player != null)
{
if (CheckBeginCast(player, true) == false)
{
if (effect != null)
effect.Cancel(true);
player.Model = player.CreationModel;
return;
}
else
{
player.Model = (ushort)effect.Spell.Value;
}
GameEventMgr.AddHandler(effect.Owner, GamePlayerEvent.RegionChanged, new DOLEventHandler(OnZone));
}
}
示例11: OnEffectPulse
public override void OnEffectPulse(GameSpellEffect effect)
{
if (storm == null || storm.ObjectState == GameObject.eObjectState.Deleted)
{
effect.Cancel(false);
return;
}
if (tempest == null || s == null)
{
return;
}
foreach (GamePlayer player in storm.GetPlayersInRadius(sRadius))
{
if (player.IsAlive) tempest.StartSpell(player);
}
}