本文整理汇总了C#中Mooege.Core.GS.Actors.Actor类的典型用法代码示例。如果您正苦于以下问题:C# Actor类的具体用法?C# Actor怎么用?C# Actor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Actor类属于Mooege.Core.GS.Actors命名空间,在下文中一共展示了Actor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InventoryGrid
public InventoryGrid(Actor owner, int rows, int columns, int slot = 0)
{
this._backpack = new uint[rows, columns];
this._owner = owner;
this.Items = new Dictionary<uint, Item>();
this.EquipmentSlot = slot;
}
示例2: RunPower
public bool RunPower(Actor user, PowerScript power, Actor target = null,
Vector3D targetPosition = null, TargetMessage targetMessage = null)
{
// replace power with existing channel instance if one exists
if (power is ChanneledSkill)
{
var existingChannel = _FindChannelingSkill(user, power.PowerSNO);
if (existingChannel != null)
{
power = existingChannel;
}
else // new channeled skill, add it to the list
{
_channeledSkills.Add((ChanneledSkill)power);
}
}
// copy in context params
power.User = user;
power.Target = target;
power.World = user.World;
power.TargetPosition = targetPosition;
power.TargetMessage = targetMessage;
_StartScript(power);
return true;
}
示例3: GenerateRandom
// generates a random item from given type category.
// we can also set a difficulty mode parameter here, but it seems current db doesnt have nightmare or hell-mode items with valid snoId's /raist.
public static Item GenerateRandom(Actor player, ItemType type)
{
var validDefinitions = ItemDefinitions[type].Where(definition => definition.SNOId != 0).ToList(); // only find item definitions with snoId!=0 for given itemtype.
var itemDefinition = GetRandom(validDefinitions);
return CreateItem(player, itemDefinition);
}
示例4: GetNearestTarget
// get nearest target of targetType
public static Actor GetNearestTarget(World world, Actor attacker, Vector3D centerPosition, float range, ActorType targetType = ActorType.Monster)
{
Actor result = null;
List<Actor> actors = world.QuadTree.Query<Actor>(new Circle(centerPosition.X, centerPosition.Y, range));
if (actors.Count > 1)
{
float distanceNearest = range; // max. range
float distance = 0f;
foreach (var target in actors.Where(target => ((target.ActorType == targetType) && (target != attacker) && !target.Attributes[GameAttribute.Is_NPC])))
{
if ((target.World == null) || (world.GetActorByDynamicId(target.DynamicID) == null))
{
// leaving world
continue;
}
distance = ActorUtils.GetDistance(centerPosition, target.Position);
if ((result == null) || (distance < distanceNearest))
{
result = target;
distanceNearest = distance;
}
}
}
return result;
}
示例5: PlayAnimation
public void PlayAnimation(Actor actor, int animationId)
{
if (actor == null) return;
foreach (Mooege.Core.GS.Player.Player player in actor.World.GetPlayersInRange(actor.Position, 150f))
{
//Stop actor current animation
player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.ANNDataMessage13)
{
ActorID = actor.DynamicID
});
player.InGameClient.SendMessage(new PlayAnimationMessage()
{
ActorID = actor.DynamicID,
Field1 = 0xb,
Field2 = 0,
tAnim = new PlayAnimationMessageSpec[1]
{
new PlayAnimationMessageSpec()
{
Field0 = 0x2,
Field1 = animationId,
Field2 = 0x0,
Field3 = 0.6f
}
}
});
}
}
示例6: GetPath
//This submits a request for a path to the pathfinder thread. This is the main point of entry for usage. - DarkLotus
public PathRequestTask GetPath(Actor owner, Vector3D vector3D, Vector3D heading)
{
if (aipather == null)
aipather = new Pathfinder();
var pathRequestTask = new PathRequestTask(aipather, owner, owner.Position, heading);
_queuedPathTasks.TryAdd(owner.DynamicID, pathRequestTask);
return pathRequestTask;
}
示例7: HitPayload
public HitPayload(AttackPayload attackPayload, bool criticalHit, Actor target)
: base(attackPayload.Context, target)
{
this.IsCriticalHit = criticalHit;
// TODO: select these values based on element type?
float weaponMinDamage = this.Context.User.Attributes[GameAttribute.Damage_Weapon_Min_Total, 0];
float weaponDamageDelta = this.Context.User.Attributes[GameAttribute.Damage_Weapon_Delta_Total, 0];
// calculate and add up damage amount for each element type
this.ElementDamages = new Dictionary<DamageType, float>();
foreach (var entry in attackPayload.DamageEntries)
{
if (!this.ElementDamages.ContainsKey(entry.DamageType))
this.ElementDamages[entry.DamageType] = 0f;
if (entry.IsWeaponBasedDamage)
this.ElementDamages[entry.DamageType] += entry.WeaponDamageMultiplier *
(weaponMinDamage + (float)PowerContext.Rand.NextDouble() * weaponDamageDelta);
else
this.ElementDamages[entry.DamageType] += entry.MinDamage + (float)PowerContext.Rand.NextDouble() * entry.DamageDelta;
this.ElementDamages[entry.DamageType] *= 1.0f + this.Target.Attributes[GameAttribute.Amplify_Damage_Percent];
}
// apply critical damage boost
if (criticalHit)
{
// TODO: probably will calculate this off of GameAttribute.Crit_Damage_Percent, but right now that attribute is never set
var damTypes = this.ElementDamages.Keys.ToArray();
foreach (var type in damTypes)
this.ElementDamages[type] *= 1.5f + this.Target.Attributes[GameAttribute.Crit_Percent_Bonus_Capped];
}
// TODO: reduce element damage amounts according to target's resistances
// TODO: reduce total damage by target's armor
// ~weltmeyer Using WOW Calculation till we find the correct formula :)
this.TotalDamage = this.ElementDamages.Sum(kv => kv.Value) ;
var targetArmor = target.Attributes[GameAttribute.Armor_Total];
var attackerLevel = attackPayload.Context.User.Attributes[GameAttribute.Level];
var reduction = TotalDamage * (0.1f * targetArmor) /
((8.5f * attackerLevel) + 40);
reduction /= 1+reduction;
reduction = Math.Min(0.75f, reduction);
this.TotalDamage = TotalDamage*(1 - reduction);
this.DominantDamageType = this.ElementDamages.OrderByDescending(kv => kv.Value).FirstOrDefault().Key;
if (this.DominantDamageType == null)
this.DominantDamageType = DamageType.Physical; // default to physical if no other damage type calced
}
示例8: ActorExists
public bool ActorExists(Actor actor)
{
return Actors.Any(
t =>
t.SnoId == actor.SnoId &&
t.Position.X == actor.Position.X &&
t.Position.Y == actor.Position.Y &&
t.Position.Z == actor.Position.Z);
}
示例9: Chase
public void Chase(Actor actor)
{
if (this.Heading == actor.Position)
return;
this.Target = actor;
this.Heading = this.Target.Position;
this.Move(this.Target);
}
示例10: Minion
public Minion(World world, int snoId, Actor master, TagMap tags)
: base(world, snoId, tags)
{
// The following two seems to be shared with monsters. One wonders why there isn't a specific actortype for minions.
this.Master = master;
this.Field2 = 0x8;
this.GBHandle.Type = (int)GBHandleType.Monster; this.GBHandle.GBID = 1;
this.Attributes[GameAttribute.Summoned_By_ACDID] = (int)master.DynamicID;
this.Attributes[GameAttribute.TeamID] = master.Attributes[GameAttribute.TeamID];
}
示例11: BroadcastIfRevealed
public void BroadcastIfRevealed(GameMessage message, Actor actor)
{
foreach (var player in this.Players.Values)
{
if (player.RevealedObjects.ContainsKey(actor.DynamicID))
{
player.InGameClient.SendMessageNow(message);
}
}
}
示例12: ShootAtAngle
// shhots projectile at 2D angle
public static void ShootAtAngle(World world, Actor projectile, float angle, float speed)
{
float[] delta = ActorUtils.GetDistanceDelta(speed, angle);
world.BroadcastInclusive(new ACDTranslateFixedMessage()
{
Id = 113, // needed
ActorId = unchecked((int)projectile.DynamicID),
Velocity = new Vector3D { X = delta[0], Y = delta[1], Z = 0 },
Field2 = 1,
AnimationTag = 1,//walkAnimationSNO
Field4 = 1,
}, projectile);
}
示例13: MonsterBrain
public MonsterBrain(Actor body)
: base(body)
{
this.PresetPowers = new List<int>();
// build list of powers defined in monster mpq data
if (body.ActorData.MonsterSNO > 0)
{
var monsterData = (Mooege.Common.MPQ.FileFormats.Monster)MPQStorage.Data.Assets[SNOGroup.Monster][body.ActorData.MonsterSNO].Data;
foreach (var monsterSkill in monsterData.SkillDeclarations)
{
if (monsterSkill.SNOPower > 0)
this.PresetPowers.Add(monsterSkill.SNOPower);
}
}
}
示例14: UsePower
public bool UsePower(Actor user, PowerScript power, Actor target = null,
Vector3D targetPosition = null, TargetMessage targetMessage = null)
{
// replace power with existing channel instance if one exists
if (power is ChanneledPower)
{
var chanpow = _FindChannelingPower(user, power.PowerSNO);
if (chanpow != null)
power = chanpow;
}
// copy in context params
power.User = user;
power.Target = target;
power.World = user.World;
power.TargetPosition = targetPosition;
power.TargetMessage = targetMessage;
// process channeled power events
var channeledPower = power as ChanneledPower;
if (channeledPower != null)
{
if (channeledPower.ChannelOpen)
{
channeledPower.OnChannelUpdated();
}
else
{
channeledPower.OnChannelOpen();
channeledPower.ChannelOpen = true;
_channeledPowers.Add(channeledPower);
}
}
var powerEnum = power.Run().GetEnumerator();
// actual power will first run here, if it yielded a timer process it in the waiting list
if (powerEnum.MoveNext() && powerEnum.Current != PowerScript.StopExecution)
{
_waitingPowers.Add(new WaitingPower
{
PowerEnumerator = powerEnum,
Implementation = power
});
}
return true;
}
示例15: PlayEffectGroupActorToActor
public void PlayEffectGroupActorToActor(int effectId, Actor from, Actor target)
{
if (target == null) return;
foreach (Mooege.Core.GS.Player.Player player in from.World.GetPlayersInRange(from.Position, 150f))
{
player.InGameClient.SendMessage(new EffectGroupACDToACDMessage()
{
Id = 0xaa,
effectSNO = effectId,
fromActorID = from.DynamicID,
toActorID = target.DynamicID
});
SendDWordTick(player.InGameClient);
}
}