本文整理汇总了C#中WCell.RealmServer.Entities.WorldObject类的典型用法代码示例。如果您正苦于以下问题:C# WorldObject类的具体用法?C# WorldObject怎么用?C# WorldObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WorldObject类属于WCell.RealmServer.Entities命名空间,在下文中一共展示了WorldObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsFriendly
public static void IsFriendly(SpellEffectHandler effectHandler, WorldObject target, ref SpellFailedReason failedReason)
{
if (effectHandler.Cast.CasterObject.MayAttack(target))
{
failedReason = SpellFailedReason.TargetEnemy;
}
}
示例2: Apply
protected override void Apply(WorldObject target)
{
var chr = (Character)target;
if (Effect.Spell.RequiredItemClass == ItemClass.Weapon && !chr.Skills.WeaponProficiency.HasAnyFlag(Effect.Spell.RequiredItemSubClassMask))
{
chr.Skills.WeaponProficiency |= Effect.Spell.RequiredItemSubClassMask;
CharacterHandler.SendProficiency(chr, ItemClass.Weapon, chr.Skills.WeaponProficiency);
}
else if (Effect.Spell.RequiredItemClass == ItemClass.Armor && !chr.Skills.ArmorProficiency.HasAnyFlag(Effect.Spell.RequiredItemSubClassMask))
{
chr.Skills.ArmorProficiency |= Effect.Spell.RequiredItemSubClassMask;
CharacterHandler.SendProficiency(chr, ItemClass.Armor, chr.Skills.ArmorProficiency);
}
if (Effect.Spell.Ability == null)
{
log.Warn("Spell {0} had Handler for Proficiency but Spell has no Skill associated with it.", Effect.Spell);
}
else if (!chr.Skills.Contains(Effect.Spell.Ability.Skill.Id))
{
chr.Skills.Add(Effect.Spell.Ability.Skill, false);
}
}
示例3: InitializeTarget
public override SpellFailedReason InitializeTarget(WorldObject target)
{
//if (((Unit)target).Health >= ((Unit)target).MaxHealth) {
// return SpellFailedReason.AlreadyAtFullHealth;
//}
return SpellFailedReason.Ok;
}
示例4: Apply
protected override void Apply(WorldObject target)
{
if (Effect.Spell.IsHearthStoneSpell && m_cast.CasterChar != null)
{
// teleport back home
var pos = m_cast.CasterChar.BindLocation;
target.AddMessage(() => ((Unit)target).TeleportTo(pos));
}
else
{
if (Effect.ImplicitTargetB == ImplicitSpellTargetType.BehindTargetLocation)
{
var unit = (Unit)target;
if (unit != null)
{
var o = unit.Orientation;
var newx = unit.Position.X - (unit.BoundingRadius + 0.5f) * (float)Math.Cos(o);
var newy = unit.Position.Y - (unit.BoundingRadius + 0.5f) * (float)Math.Sin(o);
var newpos = new Util.Graphics.Vector3(newx, newy, unit.Position.Z);
m_cast.CasterChar.TeleportTo(newpos, o);
}
}
else
{
// teleport to given target location
var map = m_cast.TargetMap;
var pos = m_cast.TargetLoc;
var ori = m_cast.TargetOrientation;
target.AddMessage(() => ((Unit)target).TeleportTo(map, pos, ori));
}
}
}
示例5: Apply
protected override void Apply(WorldObject target)
{
var npc = (NPC)target;
npc.ThreatCollection[(Unit)m_cast.Caster] +=
((Unit)m_cast.Caster).GetGeneratedThreat(CalcEffectValue(), Effect.Spell.Schools[0], Effect);
}
示例6: IsHostileOrHealable
/// <summary>
/// Duel target type
/// </summary>
/// <param name="targets"></param>
/// <param name="target"></param>
/// <param name="failedReason"></param>
public static void IsHostileOrHealable(SpellEffectHandler effectHandler, WorldObject target, ref SpellFailedReason failedReason)
{
var caster = effectHandler.Cast.CasterObject;
var spell = effectHandler.Cast.Spell;
var isHarmful = spell.HasHarmfulEffects;
var isHarmfulAndBeneficial = spell.HasHarmfulEffects == spell.HasBeneficialEffects;
if (!isHarmfulAndBeneficial)
{
if (isHarmful != caster.MayAttack(target))
{
if (isHarmful)
{
failedReason = SpellFailedReason.TargetFriendly;
}
else
{
failedReason = SpellFailedReason.TargetEnemy;
}
}
else if (isHarmful && !target.CanBeHarmed)
{
failedReason = SpellFailedReason.NotHere;
}
}
}
示例7: Apply
protected override void Apply(WorldObject target)
{
Unit unit;
if (target is Unit)
{
unit = (Unit) target;
}
else if (target is Corpse)
{
unit = ((Corpse)target).Owner;
if (unit == null || unit.IsAlive)
{
return;
}
}
else
{
return;
}
unit.Health = CalcEffectValue();
if (((Unit)target).PowerType == PowerType.Mana)
{
((Unit)target).Energize(Effect.MiscValue, m_cast.CasterUnit, Effect);
}
}
示例8: Apply
protected override void Apply(WorldObject target)
{
var chr = target as Character;
chr.TaxiNodes.Activate((uint)Effect.MiscValue);
TaxiHandler.SendTaxiPathActivated(chr.Client);
TaxiHandler.SendTaxiPathUpdate(chr.Client, Cast.CasterUnit.EntityId, true);
}
示例9: Apply
protected override void Apply(WorldObject target)
{
if (!target.IsPlayer)
{
base.Apply(target);
}
}
示例10: GossipConversation
/// <summary>
/// Creates gossip conversation by its fields
/// </summary>
/// <param name="menu">starting menu</param>
/// <param name="chr">character which started the conversation</param>
/// <param name="speaker">respondent</param>
public GossipConversation(GossipMenu menu, Character chr, WorldObject speaker, bool keepOpen)
{
CurrentMenu = menu;
Character = chr;
Speaker = speaker;
StayOpen = keepOpen;
}
示例11: Apply
protected override void Apply(WorldObject target)
{
var chr = target as Character;
if (chr != null)
{
if (target.IsFriendlyWith(Cast.CasterChar))
{
chr.Auras.RemoveFirstVisibleAura(aura => aura.Spell.HasHarmfulEffects);
if (Cast.Spell.Id == (int)SpellId.ClassSkillDispelMagicRank2)
{
chr.Auras.RemoveFirstVisibleAura(aura => aura.Spell.HasHarmfulEffects);
}
if (Cast.CasterChar.Spells.Contains(SpellId.GlyphOfDispelMagic) || Cast.CasterChar.Spells.Contains(SpellId.GlyphOfDispelMagic_2))
{
int amountToHeal = (chr.Health * 3) / 100;
chr.Target.Heal(amountToHeal, Cast.CasterChar, Effect);
}
}
else
{
chr.Auras.RemoveFirstVisibleAura(aura => aura.Spell.HasBeneficialEffects);
if (Cast.Spell.Id == (int)SpellId.ClassSkillDispelMagicRank2)
{
chr.Auras.RemoveFirstVisibleAura(aura => aura.Spell.HasHarmfulEffects);
}
}
}
}
示例12: Apply
protected override void Apply(WorldObject target)
{
if (target.IsUsingSpell)
{
target.SpellCast.Cancel(SpellFailedReason.Interrupted);
}
}
示例13: CasterInfo
public CasterInfo(WorldObject caster)
{
CasterId = caster.EntityId;
Level = caster.CasterLevel;
m_caster = caster;
//Faction = caster.Faction;
//ObjectType = caster.Type;
}
示例14: Apply
protected override void Apply(WorldObject target)
{
var chr = target as Character;
if (m_cast.CasterUnit != null && m_cast.CasterUnit is NPC)
{
chr.QuestLog.OnNPCInteraction((NPC)m_cast.CasterUnit);
}
}
示例15: MatchesRequiredTargetType
public bool MatchesRequiredTargetType(WorldObject obj)
{
if (RequiredTargetType == RequiredSpellTargetType.GameObject)
{
return obj is GameObject;
}
return obj is NPC && ((NPC) obj).IsAlive == (RequiredTargetType == RequiredSpellTargetType.NPCAlive);
}