本文整理汇总了C#中Aura.World.World.MabiCreature.GetMagicDamage方法的典型用法代码示例。如果您正苦于以下问题:C# MabiCreature.GetMagicDamage方法的具体用法?C# MabiCreature.GetMagicDamage怎么用?C# MabiCreature.GetMagicDamage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aura.World.World.MabiCreature
的用法示例。
在下文中一共展示了MabiCreature.GetMagicDamage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FireballProcessing
public void FireballProcessing(MabiCreature attacker, MabiSkill skill, MabiProp bomb, ulong targetId)
{
Thread.Sleep(4000);
var victims = WorldManager.Instance.GetCreaturesInRange(bomb, 800).Where(c => !c.IsDead && c.IsAttackableBy(attacker)).ToList();
ulong areaTarget = SkillHelper.GetAreaTargetID(bomb.Region, (uint)bomb.Info.X, (uint)bomb.Info.Y);
var sAction = new AttackerAction(CombatActionType.SpecialHit, attacker, skill.Id, areaTarget);
sAction.PropId = bomb.Id;
sAction.Options = AttackerOptions.KnockBackHit1 | AttackerOptions.UseEffect;
var cap = new CombatActionPack(attacker, skill.Id);
cap.Add(sAction);
var rnd = RandomProvider.Get();
foreach (var target in victims)
{
target.StopMove();
var tAction = new TargetAction(CombatActionType.TakeHit, target, attacker, skill.Id);
tAction.Options |= TargetOptions.Result;
tAction.StunTime = target.Stun = 3000;
tAction.Delay = 200;
var damage = attacker.GetMagicDamage(attacker.RightHand, rnd.Next((int)skill.RankInfo.Var1, (int)skill.RankInfo.Var2 + 1));
if (CombatHelper.TryAddCritical(target, ref damage, attacker.CriticalChanceAgainst(target)))
tAction.Options |= TargetOptions.Critical;
target.TakeDamage(tAction.Damage = damage);
// Knock down if dead
tAction.OldPosition = CombatHelper.KnockBack(target, bomb);
if (target.IsDead)
{
tAction.Options |= TargetOptions.FinishingKnockDown;
}
else
{
tAction.Options |= TargetOptions.KnockDown;
CombatHelper.SetAggro(attacker, target);
}
WorldManager.Instance.Broadcast(new MabiPacket(Op.Effect, target.Id).PutInt(Effect.Thunderbolt).PutByte(0), SendTargets.Range, target);
cap.Add(tAction);
}
WorldManager.Instance.HandleCombatActionPack(cap);
WorldManager.Instance.RemoveProp(bomb);
}
示例2: Start
public override SkillResults Start(MabiCreature creature, MabiSkill skill)
{
creature.Activate(CreatureConditionB.Demigod);
creature.StopMove();
// Spawn eruption
{
var pos = creature.GetPosition();
var targets = WorldManager.Instance.GetAttackableCreaturesInRange(creature, EruptionRadius);
var cap = new CombatActionPack(creature, skill.Id);
var aAction = new AttackerAction(CombatActionType.SpecialHit, creature, skill.Id, SkillHelper.GetAreaTargetID(creature.Region, pos.X, pos.Y));
aAction.Options |= AttackerOptions.KnockBackHit1 | AttackerOptions.UseEffect;
cap.Add(aAction);
foreach (var target in targets)
{
target.StopMove();
// Officials use CM skill id.
var tAction = new TargetAction(CombatActionType.TakeHit, target, creature, skill.Id);
tAction.StunTime = EruptionStun;
tAction.Delay = 1000;
// Supposedly it's magic damage
tAction.Damage = creature.GetMagicDamage(null, EruptionDamage);
target.TakeDamage(tAction.Damage);
tAction.OldPosition = CombatHelper.KnockBack(target, creature, EruptionKnockBack);
if (target.IsDead)
tAction.Options |= TargetOptions.FinishingKnockDown;
cap.Add(tAction);
}
WorldManager.Instance.HandleCombatActionPack(cap);
}
Send.EffectDelayed(Effect.AwakeningOfLight1, 800, creature);
Send.EffectDelayed(Effect.AwakeningOfLight2, 800, creature);
Send.UseMotion(creature, 67, 3, false, false);
creature.StatRegens.Add(creature.Temp.DemiHpRegen = new MabiStatRegen(Stat.Life, skill.RankInfo.Var3, creature.LifeMax));
creature.StatRegens.Add(creature.Temp.DemiMpRegen = new MabiStatRegen(Stat.Mana, skill.RankInfo.Var4, creature.ManaMax));
creature.StatRegens.Add(creature.Temp.DemiStmRegen = new MabiStatRegen(Stat.Stamina, skill.RankInfo.Var5, creature.StaminaMax));
WorldManager.Instance.CreatureStatsUpdate(creature);
return SkillResults.Okay;
}
示例3: UseCombat
public override SkillResults UseCombat(MabiCreature attacker, ulong targetId, MabiSkill skill)
{
var target = WorldManager.Instance.GetCreatureById(targetId);
if (target == null)
return SkillResults.InvalidTarget;
if (!WorldManager.InRange(attacker, target, 1200))
return SkillResults.OutOfRange;
attacker.StopMove();
WorldManager.Instance.Broadcast(new MabiPacket(Op.Effect, attacker.Id).PutInt(Effect.UseMagic).PutString(this.Name), SendTargets.Range, attacker);
Send.SkillUse(attacker.Client, attacker, skill.Id, UseStun, 1);
var sAction = new AttackerAction(CombatActionType.RangeHit, attacker, skill.Id, targetId);
sAction.Options |= AttackerOptions.Result;
var cap = new CombatActionPack(attacker, skill.Id);
cap.Add(sAction);
var rnd = RandomProvider.Get();
var damage = attacker.GetMagicDamage(attacker.RightHand, rnd.Next((int)skill.RankInfo.Var1, (int)skill.RankInfo.Var2 + 1));
attacker.Stun = sAction.StunTime = UseStun;
var targets = WorldManager.Instance.GetCreaturesInRange(target, 500).Where(c => !c.IsDead && c.IsAttackableBy(attacker)).ToList();
targets.Insert(0, target);
for (byte i = 0; i < attacker.ActiveSkillStacks && i < targets.Count; i++)
{
targets[i].StopMove();
var splashAction = new TargetAction(CombatActionType.TakeHit, targets[i], attacker, skill.Id);
splashAction.Options |= TargetOptions.Result;
cap.Add(splashAction);
splashAction.Damage = damage * ((100 - (i * 10)) / 100f);
if (CombatHelper.TryAddCritical(targets[i], ref damage, attacker.CriticalChanceAgainst(targets[i])))
splashAction.Options |= TargetOptions.Critical;
targets[i].TakeDamage(splashAction.Damage);
targets[i].Stun = splashAction.StunTime = TargetStun;
// Knock down if dead
if (targets[i].IsDead)
{
splashAction.OldPosition = CombatHelper.KnockBack(targets[i], (i == 0 ? attacker : targets[i - 1]));
splashAction.Options |= TargetOptions.FinishingKnockDown;
}
else
{
if (targets[i].KnockBack >= CombatHelper.LimitKnockBack)
{
splashAction.Options |= TargetOptions.KnockDown;
}
else
{
targets[i].KnockBack += KnockBack;
if (targets[i].KnockBack >= CombatHelper.LimitKnockBack)
{
splashAction.OldPosition = CombatHelper.KnockBack(targets[i], (i == 0 ? attacker : targets[i - 1]));
splashAction.Options |= TargetOptions.KnockBack;
}
}
targets[i].Stun = splashAction.StunTime = TargetStun;
CombatHelper.SetAggro(attacker, targets[i]);
}
}
SkillHelper.ClearStack(attacker, skill);
WorldManager.Instance.HandleCombatActionPack(cap);
SkillHelper.GiveSkillExp(attacker, skill, 20);
return SkillResults.Okay;
}
示例4: HitWithThunderbolt
private static void HitWithThunderbolt(MabiCreature attacker, MabiSkill skill, List<MabiCreature> targets, MabiProp cloud, float dmgModifier = 1)
{
var undead = targets.FirstOrDefault(c => !c.IsDead);
if (undead == null)
return;
var sAction = new AttackerAction(CombatActionType.RangeHit, attacker, skill.Id, undead.Id);
sAction.PropId = cloud.Id;
sAction.Options = AttackerOptions.KnockBackHit1 | AttackerOptions.UseEffect;
var cap = new CombatActionPack(attacker, skill.Id);
cap.Add(sAction);
var rnd = RandomProvider.Get();
foreach (var target in targets)
{
if (target.IsDead)
continue;
var tAction = new TargetAction(CombatActionType.TakeHit, target, attacker, skill.Id);
tAction.Options |= TargetOptions.Result;
var damage = attacker.GetMagicDamage(attacker.RightHand, rnd.Next((int)skill.RankInfo.Var1, (int)skill.RankInfo.Var2 + 1)) * dmgModifier;
if (CombatHelper.TryAddCritical(target, ref damage, attacker.CriticalChanceAgainst(target)))
tAction.Options |= TargetOptions.Critical;
target.TakeDamage(tAction.Damage = damage);
// Knock down if dead
if (target.IsDead)
{
tAction.OldPosition = CombatHelper.KnockBack(target, attacker);
tAction.Options |= TargetOptions.FinishingKnockDown;
}
else
{
if (target.KnockBack >= CombatHelper.LimitKnockBack)
{
tAction.Options |= TargetOptions.KnockDown;
}
else
{
target.KnockBack += KnockBack;
if (target.KnockBack >= CombatHelper.LimitKnockBack)
{
tAction.OldPosition = CombatHelper.KnockBack(target, attacker);
tAction.Options |= TargetOptions.KnockBack;
}
}
target.Stun = tAction.StunTime = 2000;
CombatHelper.SetAggro(attacker, target);
}
WorldManager.Instance.Broadcast(new MabiPacket(Op.Effect, target.Id).PutInt(Effect.Thunderbolt).PutByte(0), SendTargets.Range, target);
cap.Add(tAction);
}
WorldManager.Instance.HandleCombatActionPack(cap);
}
示例5: UseCombat
public override SkillResults UseCombat(MabiCreature attacker, ulong targetId, MabiSkill skill)
{
var itarget = WorldManager.Instance.GetCreatureById(targetId);
if (itarget == null)
return SkillResults.InvalidTarget;
if (!WorldManager.InRange(attacker, itarget, 2000))
return SkillResults.OutOfRange;
attacker.StopMove();
WorldManager.Instance.Broadcast(new MabiPacket(Op.Effect, attacker.Id).PutInt(Effect.UseMagic).PutString("thunder").PutByte(0).PutLong(targetId).PutShort((ushort)skill.Id), SendTargets.Range, attacker);
var charges = attacker.ActiveSkillStacks;
List<MabiCreature> targets = new List<MabiCreature>() { itarget };
this.GetThunderChain(attacker, itarget, targets, ((byte)skill.Rank >= (byte)SkillRank.R1 ? 4 : 1) + (charges - 1) * 2);
var pos = itarget.GetPosition();
var cloud = new MabiProp(280, itarget.Region, pos.X, pos.Y, 0);
WorldManager.Instance.AddProp(cloud);
var lbPacket = new MabiPacket(Op.Effect, Id.Broadcast).PutInt(Effect.Lightningbolt).PutLong(attacker.Id).PutInt((uint)targets.Count);
foreach (var target in targets)
{
lbPacket.PutLong(target.Id);
}
WorldManager.Instance.Broadcast(lbPacket, SendTargets.Range, attacker);
Send.SkillUse(attacker.Client, attacker, skill.Id, UseStun, 1);
SkillHelper.ClearStack(attacker, skill);
// End the lightning balls
WorldManager.Instance.Broadcast(new MabiPacket(Op.Effect, attacker.Id).PutInt(Effect.StackUpdate).PutString("lightningbolt").PutBytes(0, 0), SendTargets.Range, attacker);
var sAction = new AttackerAction(CombatActionType.RangeHit, attacker, skill.Id, targetId);
sAction.Options |= AttackerOptions.Result;
attacker.Stun = sAction.StunTime = UseStun;
var cap = new CombatActionPack(attacker, skill.Id);
cap.Add(sAction);
var rnd = RandomProvider.Get();
foreach (var target in targets)
{
var tAction = new TargetAction(CombatActionType.TakeHit, target, attacker, skill.Id);
tAction.Options |= TargetOptions.Result;
cap.Add(tAction);
var damage = attacker.GetMagicDamage(attacker.RightHand, rnd.Next((int)skill.RankInfo.Var4, (int)skill.RankInfo.Var5 + 1));
if (CombatHelper.TryAddCritical(target, ref damage, attacker.CriticalChanceAgainst(target)))
tAction.Options |= TargetOptions.Critical;
target.TakeDamage(tAction.Damage = damage);
// Knock down if dead
if (target.IsDead)
{
tAction.OldPosition = CombatHelper.KnockBack(target, attacker);
tAction.Options |= TargetOptions.FinishingKnockDown;
}
else
{
if (target.KnockBack >= CombatHelper.LimitKnockBack)
{
tAction.Options |= TargetOptions.KnockDown;
}
else
{
target.KnockBack += KnockBack;
if (target.KnockBack >= CombatHelper.LimitKnockBack)
{
tAction.OldPosition = CombatHelper.KnockBack(target, attacker);
tAction.Options |= TargetOptions.KnockBack;
}
}
target.Stun = tAction.StunTime = (ushort)skill.RankInfo.Var3;
CombatHelper.SetAggro(attacker, target);
}
}
WorldManager.Instance.HandleCombatActionPack(cap);
SkillHelper.GiveSkillExp(attacker, skill, 20);
System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(() =>
{
this.ThunderProcessing(attacker, skill, targets, cloud, DateTime.Now.AddMilliseconds(skill.RankInfo.Var3), charges);
}));
t.Start();
//.........这里部分代码省略.........
示例6: Explode
protected void Explode(MabiCreature attacker, MabiCreature target, MabiSkill skill, MabiProp casterProp, float dmgModifier = 1f)
{
WorldManager.Instance.Broadcast(new MabiPacket(Op.Effect, target.Id).PutInt(Effect.IcespearFreeze).PutByte(1).PutInt(0), SendTargets.Range, target); // Cancel freeze
var tPos = target.GetPosition();
var bombProp = new MabiProp(280, target.Region, tPos.X, tPos.Y, 0); //4
WorldManager.Instance.AddProp(bombProp);
WorldManager.Instance.Broadcast(new MabiPacket(Op.Effect, bombProp.Id).PutInts(Effect.IcespearBoom, target.Region, tPos.X, tPos.Y), SendTargets.Range, bombProp);
WorldManager.Instance.Broadcast(new MabiPacket(Op.Effect, target.Id).PutInt(Effect.Thunderbolt).PutByte(0), SendTargets.Range, target);
var sAction = new AttackerAction(CombatActionType.SpecialHit, attacker, skill.Id, SkillHelper.GetAreaTargetID(target.Region, tPos.X, tPos.Y));
sAction.PropId = casterProp.Id;
sAction.Options = AttackerOptions.KnockBackHit1 | AttackerOptions.UseEffect;
var tAction = new TargetAction(CombatActionType.TakeHit, target, attacker, skill.Id);
tAction.Options = TargetOptions.Result;
tAction.StunTime = target.Stun = 2000;
var rnd = RandomProvider.Get();
var damage = attacker.GetMagicDamage(attacker.RightHand, rnd.Next((int)skill.RankInfo.Var1, (int)skill.RankInfo.Var2 + 1)) * dmgModifier;
if (CombatHelper.TryAddCritical(target, ref damage, attacker.CriticalChanceAgainst(target)))
tAction.Options |= TargetOptions.Critical;
target.TakeDamage(tAction.Damage = damage);
// Knock down if dead
tAction.OldPosition = CombatHelper.KnockBack(target, bombProp);
if (target.IsDead)
{
tAction.Options |= TargetOptions.FinishingKnockDown;
}
else
{
tAction.Options |= TargetOptions.KnockDown;
CombatHelper.SetAggro(attacker, target);
}
var cap = new CombatActionPack(attacker, skill.Id);
cap.Add(sAction, tAction);
WorldManager.Instance.HandleCombatActionPack(cap);
sAction = new AttackerAction(CombatActionType.SpecialHit, attacker, skill.Id, SkillHelper.GetAreaTargetID(target.Region, tPos.X, tPos.Y));
sAction.PropId = bombProp.Id;
sAction.Options = AttackerOptions.UseEffect;
cap = new CombatActionPack(attacker, skill.Id);
cap.Add(sAction);
WorldManager.Instance.HandleCombatActionPack(cap);
WorldManager.Instance.RemoveProp(bombProp);
}