本文整理汇总了C#中AttackPayload类的典型用法代码示例。如果您正苦于以下问题:C# AttackPayload类的具体用法?C# AttackPayload怎么用?C# AttackPayload使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AttackPayload类属于命名空间,在下文中一共展示了AttackPayload类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public override IEnumerable<TickTimer> Main()
{
float reachLength;
float reachThickness;
switch(ComboIndex)
{
case 0:
reachLength = 13;
reachThickness = 3f;
break;
case 1:
reachLength = 14;
reachThickness = 4.5f;
break;
case 2:
reachLength = 18;
reachThickness = 4.5f;
break;
default:
yield break;
}
bool hitAnything = false;
AttackPayload attack = new AttackPayload(this);
attack.Targets = GetEnemiesInBeamDirection(User.Position, TargetPosition, reachLength, reachThickness);
attack.AddWeaponDamage(1.20f, DamageType.Physical);
attack.OnHit = hitPayload => { hitAnything = true; };
attack.Apply();
if (hitAnything)
GeneratePrimaryResource(6f);
yield break;
}
示例2: Main
public override IEnumerable<TickTimer> Main()
{
bool hitAnything = false;
var ShockWavePos = PowerMath.TranslateDirection2D(User.Position, TargetPosition,
User.Position,
ScriptFormula(23));
var maxHits = ScriptFormula(1);
for (int i = 0; i < maxHits; ++i)
{
AttackPayload attack = new AttackPayload(this);
attack.Targets = GetBestMeleeEnemy();
if (i == 0)
{ attack.AddWeaponDamage(ScriptFormula(3), DamageType.Physical); }
else
{ attack.AddWeaponDamage(ScriptFormula(12), DamageType.Physical); }
attack.OnHit = hitPayload =>
{
hitAnything = true;
if (Rune_D > 0)
{
GeneratePrimaryResource(ScriptFormula(10));
}
if (Rune_B > 0)
{
AddBuff(User, new AddDamageBuff());
}
if (Rune_A > 0)
{
}
else if (Rune_C > 0)
{
if (Rand.NextDouble() < ScriptFormula(14))
AddBuff(hitPayload.Target, new DebuffStunned(WaitSeconds(ScriptFormula(15))));
}
else
{
if (Rand.NextDouble() < ScriptFormula(0))
Knockback(hitPayload.Target, ScriptFormula(5), ScriptFormula(6), ScriptFormula(7));
}
};
attack.Apply();
yield return WaitSeconds(ScriptFormula(13));
if(hitAnything)
GeneratePrimaryResource(EvalTag(PowerKeys.ResourceGainedOnFirstHit));
}
//Shockwave -> capsule distance, at the moment using beamdirection
if (Rune_E > 0)
{
User.PlayEffectGroup(93867);
yield return WaitSeconds(0.5f);
WeaponDamage(GetEnemiesInBeamDirection(ShockWavePos, TargetPosition, 30f, 8f), ScriptFormula(18), DamageType.Physical);
}
yield break;
}
示例3: OnAttackPayload
// I attacked someone
private void OnAttackPayload(AttackPayload payload)
{
foreach (Combatant target in payload.Targets)
{
var hitPayload = new HitPayload(payload, this, payload.Power);
target.SendMessage(hitPayload);
}
}
示例4: 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
}
示例5: Main
public override IEnumerable<TickTimer> Main()
{
AttackPayload attack = new AttackPayload(this);
attack.Targets = GetBestMeleeEnemy();
attack.AddWeaponDamage(1.45f, DamageType.Physical);
attack.OnHit = hitPayload =>
{
GeneratePrimaryResource(6f);
if (Rand.NextDouble() < 0.20)
Knockback(hitPayload.Target, ScriptFormula(5), ScriptFormula(6), ScriptFormula(7));
};
attack.Apply();
yield break;
}
示例6: HitPayload
public HitPayload(AttackPayload attackPayload, bool criticalHit, Actor target)
{
this.Context = attackPayload.Context;
this.Target = 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;
}
// 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.0f + 0.25f;
}
// TODO: reduce element damage amounts according to target's resistances
// TODO: reduce total damage by target's armor
this.TotalDamage = this.ElementDamages.Sum(kv => kv.Value);
this.DominantDamageType = this.ElementDamages.OrderByDescending(kv => kv.Value).FirstOrDefault().Key;
}
示例7: Run
public override IEnumerable<TickTimer> Run()
{
yield return WaitSeconds(0.25f); // wait for swing animation
User.PlayEffectGroup(18662);
if (CanHitMeleeTarget(Target))
{
var payload = new AttackPayload(this);
payload.AddTarget(Target);
payload.AddWeaponDamage(1.45f, DamageType.Physical);
payload.OnHit = (hit) =>
{
GeneratePrimaryResource(6f);
if (Rand.NextDouble() < 0.20)
Knockback(Target, 4f);
};
payload.Apply();
}
yield break;
}
示例8: Main
public override IEnumerable<TickTimer> Main()
{
switch (TargetMessage.Field5)
{
case 0:
if (Rune_A > 0)
{
//Dash
}
else
{
MeleeStageHit();
}
break;
case 1:
//stage 2 get hit chance bonus
MultiHit();
break;
case 2:
if (Rune_D > 0)
{
if(Rand.NextDouble() < ScriptFormula(25))
{
GeneratePrimaryResource(ScriptFormula(24));
}
}
bool hitAnything = false;
AttackPayload attack = new AttackPayload(this);
attack.Targets = GetEnemiesInArcDirection(User.Position, TargetPosition, ScriptFormula(30), ScriptFormula(31));
attack.AddWeaponDamage(ScriptFormula(2), DamageType.Holy);
attack.OnHit = hitPayload =>
{
hitAnything = true;
Knockback(hitPayload.Target, ScriptFormula(5), ScriptFormula(6));
if (Rune_A > 0)
{
AddBuff(hitPayload.Target, new RuneA_DOT_100Fists());
}
};
attack.Apply();
if (hitAnything)
{
GeneratePrimaryResource(EvalTag(PowerKeys.SpiritGained));
if (Rune_C > 0)
{
AddBuff(User, new RuneCbuff());
}
}
//TODO: Range should be only 40f ahead.
if (Rune_E > 0)
{
var proj = new Projectile(this, 136022, User.Position);
proj.Launch(TargetPosition, ScriptFormula(23));
proj.OnCollision = (hit) =>
{
//proj.Destroy();
WeaponDamage(hit, ScriptFormula(11), DamageType.Physical);
};
}
break;
}
yield break;
}
示例9: Update
public override bool Update()
{
if (base.Update())
return true;
if (_damageTimer == null || _damageTimer.TimedOut)
{
_damageTimer = WaitSeconds(_damageRate);
AttackPayload attack = new AttackPayload(this);
attack.Targets = GetEnemiesInRadius(User.Position, ScriptFormula(13));
attack.AddWeaponDamage(_damagetotal, DamageType.Physical);
//we divide by four because this is by second, and tick-intervals = 0.25
attack.AutomaticHitEffects = false;
attack.Apply();
}
return false;
}
示例10: MeleeStageHit
private void MeleeStageHit()
{
AttackPayload attack = new AttackPayload(this);
attack.Targets = GetEnemiesInRadius(User.Position, ScriptFormula(1));
attack.AddWeaponDamage(ScriptFormula(4), DamageType.Physical);
attack.Apply();
}
示例11: MultiHit
private void MultiHit()
{
if (Rune_D > 0)
{
if (Rand.NextDouble() < ScriptFormula(25))
{
GeneratePrimaryResource(ScriptFormula(24));
}
}
//TODO: this needs to be redone when I figure out how to do multiple hits to certain MAX targets..
bool hitAnything = false;
AttackPayload attack = new AttackPayload(this);
attack.Targets = GetEnemiesInArcDirection(User.Position,TargetPosition, ScriptFormula(28), ScriptFormula(29));
attack.AddWeaponDamage(ScriptFormula(1), DamageType.Physical);
attack.OnHit = hitPayload =>
{
hitAnything = true;
if (Rune_A > 0)
{
AddBuff(hitPayload.Target, new RuneA_DOT_100Fists());
}
};
attack.Apply();
if (hitAnything)
{
GeneratePrimaryResource(EvalTag(PowerKeys.SpiritGained));
if (Rune_C > 0)
{
AddBuff(User, new RuneCbuff());
}
}
}
示例12: Update
public override bool Update()
{
_mover.Update();
if (base.Update())
return true;
if (_damageTimer == null || _damageTimer.TimedOut)
{
_damageTimer = WaitSeconds(_damageRate);
AttackPayload attack = new AttackPayload(this);
attack.AddWeaponDamage(ScriptFormula(16), DamageType.Physical);
attack.Targets = GetEnemiesInRadius(User.Position, ScriptFormula(6));
attack.OnHit = hit =>
{
hitAnything = true;
Knockback(hit.Target, ScriptFormula(2));
if (Rune_B > 0)
{
User.Attributes[GameAttribute.Hitpoints_Granted] += ScriptFormula(21);
User.Attributes.BroadcastChangedIfRevealed();
}
if (Rune_D > 0)
{
GeneratePrimaryResource(ScriptFormula(11));
}
if (Rune_C > 0)
{
if (hit.IsCriticalHit)
{
AddBuff(hit.Target, new DebuffStunned(WaitSeconds(ScriptFormula(8))));
}
}
if (Rune_E > 0)
{
int resourceHit = 0;
while (resourceHit < ScriptFormula(10))
{
//maybe this cannot go here?
}
}
};
attack.Apply();
}
return false;
}
示例13: Main
public override IEnumerable<TickTimer> Main()
{
AttackPayload attack = new AttackPayload(this);
attack.Targets = GetEnemiesInRadius(User.Position, ScriptFormula(4));
attack.OnHit = hitPayload =>
{
AddBuff(hitPayload.Target, new RendDebuff());
};
//this work? if it dies with rend debuff, infect others.
attack.OnDeath = DeathPayload =>
{
if (AddBuff(Target, new RendDebuff()))
{
AttackPayload BleedAgain = new AttackPayload(this);
BleedAgain.Targets = GetEnemiesInRadius(Target.Position, ScriptFormula(19));
BleedAgain.OnHit = hitPayload2 =>
{
AddBuff(hitPayload2.Target, new RendDebuff());
};
BleedAgain.Apply();
}
};
attack.Apply();
yield break;
}
示例14: Apply
public override bool Apply()
{
if (!base.Apply())
return false;
User.Attributes[GameAttribute.Damage_Percent_Reduction_From_Melee] += ScriptFormula(10);
User.Attributes[GameAttribute.Damage_Percent_Reduction_From_Ranged] += ScriptFormula(10);
Target.Attributes.BroadcastChangedIfRevealed();
if (Rune_D > 0)
{
AttackPayload attack = new AttackPayload(this);
attack.Targets = GetEnemiesInRadius(User.Position, ScriptFormula(8));
attack.AddWeaponDamage(ScriptFormula(11), DamageType.Physical);
attack.OnHit = hitPayload =>
{
Knockback(hitPayload.Target, ScriptFormula(6), ScriptFormula(7));
};
attack.Apply();
}
return true;
}