本文整理汇总了C#中Aura.World.World.MabiCreature.GetRndTotalDamage方法的典型用法代码示例。如果您正苦于以下问题:C# MabiCreature.GetRndTotalDamage方法的具体用法?C# MabiCreature.GetRndTotalDamage怎么用?C# MabiCreature.GetRndTotalDamage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aura.World.World.MabiCreature
的用法示例。
在下文中一共展示了MabiCreature.GetRndTotalDamage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UseCombat
public override SkillResults UseCombat(MabiCreature attacker, ulong targetId, MabiSkill skill)
{
var target = WorldManager.Instance.GetCreatureById(targetId);
if (target == null)
return SkillResults.InvalidTarget;
var sAction = new AttackerAction(CombatActionType.HardHit, attacker, skill.Id, targetId);
sAction.Options |= AttackerOptions.Result;
var tAction = new TargetAction(CombatActionType.CounteredHit, target, attacker, skill.Id);
tAction.Options |= TargetOptions.Result | TargetOptions.KnockDown;
var cap = new CombatActionPack(attacker, skill.Id);
cap.Add(sAction, tAction);
var damage =
(attacker.GetRndTotalDamage() * (skill.RankInfo.Var2 / 100f)) +
(target.GetRndTotalDamage() * (skill.RankInfo.Var1 / 100f));
if (CombatHelper.TryAddCritical(attacker, ref damage, (target.CriticalChanceAgainst(attacker) + skill.RankInfo.Var3)))
tAction.Options |= TargetOptions.Critical;
CombatHelper.ReduceDamage(ref damage, target.DefenseTotal, target.Protection);
target.TakeDamage(tAction.Damage = damage);
if (target.IsDead)
tAction.Options |= TargetOptions.FinishingKnockDown;
attacker.Stun = sAction.StunTime = StunTime;
target.Stun = tAction.StunTime = StunTime;
tAction.OldPosition = CombatHelper.KnockBack(target, attacker);
WorldManager.Instance.HandleCombatActionPack(cap);
Send.SkillUse(attacker.Client, attacker, skill.Id, StunTime, 1);
SkillHelper.GiveSkillExp(attacker, skill, 20);
return SkillResults.Okay;
}
示例2: Use
public override SkillResults Use(MabiCreature attacker, MabiSkill skill, MabiPacket packet)
{
//Logger.Debug(packet);
var targetId = packet.GetLong();
var unk1 = packet.GetInt();
var unk2 = packet.GetInt();
// Determine range, doesn't seem to be included in rank info.
var range = this.GetRange(skill);
// Add attack range from race, range must increase depending on "size".
range += (uint)attacker.RaceInfo.AttackRange;
var enemies = WorldManager.Instance.GetAttackableCreaturesInRange(attacker, range);
if (enemies.Count < 1)
{
Send.Notice(attacker.Client, Localization.Get("skills.wm_no_target")); // Unable to use when there is no target.
Send.SkillSilentCancel(attacker.Client, attacker);
return SkillResults.OutOfRange | SkillResults.Failure;
}
var rnd = RandomProvider.Get();
attacker.StopMove();
// Spin motion
Send.UseMotion(attacker, 8, 4);
var cap = new CombatActionPack(attacker, skill.Id);
// One source action, target actions are added for every target
// and then we send the pack on its way.
var sAction = new AttackerAction(CombatActionType.Hit, attacker, skill.Id, targetId);
sAction.Options |= AttackerOptions.Result | AttackerOptions.KnockBackHit1;
cap.Add(sAction);
attacker.Stun = sAction.StunTime = 2500;
// For aggro selection, only one enemy gets it.
MabiCreature aggroTarget = null;
var survived = new List<MabiCreature>();
foreach (var target in enemies)
{
target.StopMove();
var tAction = new TargetAction(CombatActionType.TakeHit, target, attacker, skill.Id);
cap.Add(tAction);
var damage = attacker.GetRndTotalDamage();
damage *= skill.RankInfo.Var1 / 100;
if (CombatHelper.TryAddCritical(attacker, ref damage, attacker.CriticalChance))
tAction.Options |= TargetOptions.Critical;
target.TakeDamage(tAction.Damage = damage);
if (target.IsDead)
tAction.Options |= TargetOptions.FinishingKnockDown;
tAction.Options |= TargetOptions.KnockDown;
target.Stun = tAction.StunTime = CombatHelper.GetStunTarget(CombatHelper.GetAverageAttackSpeed(attacker), true);
tAction.OldPosition = CombatHelper.KnockBack(target, attacker, 375);
tAction.Delay = (uint)rnd.Next(300, 351);
if (target.Target == attacker)
aggroTarget = target;
if (!target.IsDead)
survived.Add(target);
}
// No aggro yet, random target.
if (aggroTarget == null && survived.Count > 0)
aggroTarget = survived[rnd.Next(0, survived.Count)];
if (aggroTarget != null)
CombatHelper.SetAggro(attacker, aggroTarget);
WorldManager.Instance.HandleCombatActionPack(cap);
Send.SkillUse(attacker.Client, attacker, skill.Id, targetId, unk1, unk2);
//attacker.Client.SendSkillStackUpdate(attacker, skill.Id, 0);
SkillHelper.DecStack(attacker, skill);
SkillHelper.GiveSkillExp(attacker, skill, 20);
return SkillResults.Okay;
}
示例3: calculateSmashDamage
private float calculateSmashDamage(MabiCreature attacker, MabiCreature target)
{
var dmg = attacker.GetRndTotalDamage();
dmg *= attacker.Skills.Get(SkillConst.Smash).RankInfo.Var1 / 100f;
if (attacker.RightHand != null && attacker.RightHand.IsTwoHandWeapon)
{
dmg *= 1.20f;
}
return dmg;
}