本文整理汇总了C#中Aura.Channel.World.Entities.Creature类的典型用法代码示例。如果您正苦于以下问题:C# Creature类的具体用法?C# Creature怎么用?C# Creature使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Creature类属于Aura.Channel.World.Entities命名空间,在下文中一共展示了Creature类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartGift
/// <summary>
/// Starts a new session and calls Gift.
/// </summary>
/// <param name="target"></param>
/// <param name="creature"></param>
/// <param name="gift"></param>
public void StartGift(NPC target, Creature creature, Item gift)
{
if (!this.Start(target, creature))
return;
this.Script.GiftAsync(gift);
}
示例2: Handle
/// <summary>
/// Checks if target's Mana Shield is active, calculates mana
/// damage, and sets target action's Mana Damage property if applicable.
/// </summary>
/// <param name="target"></param>
/// <param name="damage"></param>
/// <param name="tAction"></param>
public static void Handle(Creature target, ref float damage, TargetAction tAction)
{
// Mana Shield active?
if (!target.Conditions.Has(ConditionsA.ManaShield))
return;
// Get Mana Shield skill to get the rank's vars
var manaShield = target.Skills.Get(SkillId.ManaShield);
if (manaShield == null) // Checks for things that should never ever happen, yay.
return;
// Var 1 = Efficiency
var manaDamage = damage / manaShield.RankData.Var1;
if (target.Mana >= manaDamage)
{
// Damage is 0 if target's mana is enough to cover it
damage = 0;
}
else
{
// Set mana damage to target's mana and reduce the remaining
// damage from life if the mana is not enough.
damage -= (manaDamage - target.Mana) * manaShield.RankData.Var1;
manaDamage = target.Mana;
}
// Reduce mana
target.Mana -= manaDamage;
if (target.Mana <= 0)
ChannelServer.Instance.SkillManager.GetHandler<StartStopSkillHandler>(SkillId.ManaShield).Stop(target, manaShield);
tAction.ManaDamage = manaDamage;
}
示例3: Prepare
public bool Prepare(Creature creature, Skill skill, Packet packet)
{
Send.SkillFlashEffect(creature);
Send.SkillPrepare(creature, skill.Info.Id, skill.GetCastTime());
return true;
}
示例4: BurnItemR
/// <summary>
/// Sends BurnItemR to creature's client.
/// </summary>
/// <param name="creature"></param>
/// <param name="success"></param>
public static void BurnItemR(Creature creature, bool success)
{
var packet = new Packet(Op.BurnItemR, creature.EntityId);
packet.PutByte(success);
creature.Client.Send(packet);
}
示例5: StartTalk
/// <summary>
/// Starts a new session and calls Talk.
/// </summary>
/// <param name="target"></param>
/// <param name="creature"></param>
public void StartTalk(NPC target, Creature creature)
{
if (!this.Start(target, creature))
return;
this.Script.TalkAsync();
}
示例6: OnPlayerHealsCreature
/// <summary>
/// Handles healing training.
/// </summary>
/// <param name="creature"></param>
/// <param name="target"></param>
/// <param name="skill"></param>
private void OnPlayerHealsCreature(Creature creature, Creature target, Skill healingSkill)
{
var skill = creature.Skills.Get(SkillId.MagicMastery);
if (skill == null)
return;
if (healingSkill.Info.Id == SkillId.Healing)
{
var index = 0;
if (skill.Info.Rank >= SkillRank.RF && skill.Info.Rank <= SkillRank.RD)
index = 1;
else if (skill.Info.Rank >= SkillRank.RC && skill.Info.Rank <= SkillRank.R6)
index = 3;
if (index != 0)
{
skill.Train(index); // Use Healing magic on an injured person.
if (target.Life < 0)
skill.Train(index + 1); // Use Healing magic on a critically injured person.
}
}
else if (healingSkill.Info.Id == SkillId.PartyHealing && !creature.IsGiant)
{
if (skill.Info.Rank >= SkillRank.R5 && skill.Info.Rank <= SkillRank.R1)
skill.Train(7); // Use Party Healing.
}
}
示例7: Disappear
/// <summary>
/// Sends Disappear to creature's client.
/// </summary>
/// <remarks>
/// Should this be broadcasted? What does it even do? TODO.
/// </remarks>
/// <param name="creature"></param>
public static void Disappear(Creature creature)
{
var packet = new Packet(Op.Disappear, MabiId.Channel);
packet.PutLong(creature.EntityId);
creature.Client.Send(packet);
}
示例8: MailsRequestR
/// <summary>
/// Sends MailsRequestR to creature's client.
/// </summary>
/// <param name="creature"></param>
public static void MailsRequestR(Creature creature)
{
var packet = new Packet(Op.MailsRequestR, creature.EntityId);
// ...
creature.Client.Send(packet);
}
示例9: HandleMagicDefenseProtection
/// <summary>
/// Reduces damage by target's magic defense and protection.
/// </summary>
/// <param name="target"></param>
/// <param name="damage"></param>
/// <param name="defense"></param>
/// <param name="protection"></param>
public static void HandleMagicDefenseProtection(Creature target, ref float damage, bool defense = true, bool protection = true)
{
if (defense)
damage = Math.Max(1, damage - target.MagicDefense);
if (protection && damage > 1)
damage = Math.Max(1, damage - (damage / 100 * target.MagicProtection));
}
示例10: UseSkillOnTarget
/// <summary>
/// Bolt specific use code.
/// </summary>
/// <param name="attacker"></param>
/// <param name="skill"></param>
/// <param name="target"></param>
protected override void UseSkillOnTarget(Creature attacker, Skill skill, Creature mainTarget)
{
// Create actions
var aAction = new AttackerAction(CombatActionType.RangeHit, attacker, skill.Info.Id, mainTarget.EntityId);
aAction.Set(AttackerOptions.Result);
var cap = new CombatActionPack(attacker, skill.Info.Id, aAction);
var targets = new List<Creature>();
targets.Add(mainTarget);
targets.AddRange(mainTarget.Region.GetCreaturesInRange(mainTarget.GetPosition(), SplashRange).Where(a => a != mainTarget && attacker.CanTarget(a) && attacker.CanAttack(a)));
// Damage
var damage = this.GetDamage(attacker, skill);
var max = Math.Min(targets.Count, skill.Stacks);
for (int i = 0; i < max; ++i)
{
var target = targets[i];
var targetDamage = damage;
target.StopMove();
var tAction = new TargetAction(CombatActionType.TakeHit, target, attacker, skill.Info.Id);
tAction.Set(TargetOptions.Result);
tAction.Stun = TargetStun;
// Full damage for the first target, -10% for every subsequent one.
targetDamage -= (targetDamage * 0.1f) * i;
// Reduce damage
var maxDamage = damage; //Damage without Defense and Protection
// Reduce damage
Defense.Handle(aAction, tAction);
SkillHelper.HandleMagicDefenseProtection(target, ref targetDamage);
ManaShield.Handle(target, ref targetDamage, tAction, maxDamage, true);
// Deal damage
if (targetDamage > 0)
target.TakeDamage(tAction.Damage = targetDamage, attacker);
if (target == mainTarget)
target.Aggro(attacker);
// Death/Knockback
this.HandleKnockBack(attacker, target, tAction);
cap.Add(tAction);
}
// Override stun set by defense
aAction.Stun = AttackerStun;
Send.Effect(attacker, Effect.UseMagic, EffectSkillName);
Send.SkillUseStun(attacker, skill.Info.Id, aAction.Stun, 1);
this.BeforeHandlingPack(attacker, skill);
cap.Handle();
}
示例11: QuestClear
/// <summary>
/// Sends QuestClear to creature's client.
/// </summary>
/// <remarks>
/// Removes quest from quest log.
/// </remarks>
/// <param name="creature"></param>
/// <param name="questId"></param>
public static void QuestClear(Creature creature, long questId)
{
var packet = new Packet(Op.QuestClear, creature.EntityId);
packet.PutLong(questId);
creature.Client.Send(packet);
}
示例12: PetUnregister
/// <summary>
/// Sends PetUnregister to creature's client.
/// </summary>
/// <param name="creature"></param>
/// <param name="pet"></param>
public static void PetUnregister(Creature creature, Creature pet)
{
var packet = new Packet(Op.PetUnregister, creature.EntityId);
packet.PutLong(pet.EntityId);
creature.Client.Send(packet);
}
示例13: TelePetR
/// <summary>
/// Sends TelePetR to pet's client.
/// </summary>
/// <param name="pet"></param>
/// <param name="success"></param>
public static void TelePetR(Creature pet, bool success)
{
var packet = new Packet(Op.TelePetR, pet.EntityId);
packet.PutByte(success);
pet.Client.Send(packet);
}
示例14: Complete
/// <summary>
/// Completes skill, dropping a cobweb.
/// </summary>
/// <param name="creature"></param>
/// <param name="skill"></param>
/// <param name="packet"></param>
public void Complete(Creature creature, Skill skill, Packet packet)
{
var cobweb = new Item(ItemId);
cobweb.Drop(creature.Region, creature.GetPosition(), 200, creature, true);
Send.SkillComplete(creature, skill.Info.Id);
}
示例15: Prepare
/// <summary>
/// Prepares skill, goes straight to use to skip readying and using it.
/// </summary>
/// <remarks>
/// The client will take a moment to send the Complete packet,
/// as if it would cast the skill first.
/// </remarks>
/// <param name="creature"></param>
/// <param name="skill"></param>
/// <param name="packet"></param>
public bool Prepare(Creature creature, Skill skill, Packet packet)
{
Send.SkillUse(creature, skill.Info.Id, 0);
skill.State = SkillState.Used;
return true;
}