本文整理汇总了C#中AttackData类的典型用法代码示例。如果您正苦于以下问题:C# AttackData类的具体用法?C# AttackData怎么用?C# AttackData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AttackData类属于命名空间,在下文中一共展示了AttackData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Damage
public Damage(float amount, AttackData attackData, RaycastHit hitLocation, Transform attackerTransform)
{
HitLocation = hitLocation;
Amount = amount;
Attacker = attackerTransform;
Attack = attackData;
}
示例2: StealLife
/// <summary>
/// Uses percent of damage to heal the caster
/// </summary>
public virtual void StealLife(AttackData ad)
{
if (ad == null) return;
if (!m_caster.IsAlive) return;
if (ad.Target is Keeps.GameKeepDoor || ad.Target is Keeps.GameKeepComponent)
{
return;
}
int heal = (ad.Damage + ad.CriticalDamage) * m_spell.LifeDrainReturn / 100;
if (m_caster.IsDiseased)
{
MessageToCaster("You are diseased!", eChatType.CT_SpellResisted);
heal >>= 1;
}
if (heal <= 0) return;
heal = m_caster.ChangeHealth(m_caster, GameLiving.eHealthChangeType.Spell, heal);
if (heal > 0)
{
MessageToCaster("You steal " + heal + " hit point" + (heal == 1 ? "." : "s."), eChatType.CT_Spell);
}
else
{
MessageToCaster("You cannot absorb any more life.", eChatType.CT_SpellResisted);
}
}
示例3: EventHandler
/// <summary>
/// Handler fired on every melee attack by effect target
/// </summary>
/// <param name="e"></param>
/// <param name="sender"></param>
/// <param name="arguments"></param>
protected void EventHandler(DOLEvent e, object sender, EventArgs arguments)
{
AttackFinishedEventArgs atkArgs = arguments as AttackFinishedEventArgs;
if (atkArgs == null) return;
if (atkArgs.AttackData.AttackResult != GameLiving.eAttackResult.HitUnstyled
&& atkArgs.AttackData.AttackResult != GameLiving.eAttackResult.HitStyle) return;
if (atkArgs.AttackData.Target == null) return;
GameLiving target = atkArgs.AttackData.Target;
if (target == null) return;
if (target.ObjectState != GameObject.eObjectState.Active) return;
if (target.IsAlive == false) return;
GameLiving attacker = sender as GameLiving;
if (attacker == null) return;
if (attacker.ObjectState != GameObject.eObjectState.Active) return;
if (attacker.IsAlive == false) return;
if (atkArgs.AttackData.IsOffHand) return; // only react to main hand
if (atkArgs.AttackData.Weapon == null) return; // no weapon attack
int modifier = 100;
//double dpsCap = (1.2 + 0.3 * attacker.Level) * 0.7;
//double dps = Math.Min(atkArgs.AttackData.Weapon.DPS_AF/10.0, dpsCap);
double baseDamage = atkArgs.AttackData.Weapon.DPS_AF / 10.0 *
atkArgs.AttackData.WeaponSpeed;
modifier += (int)(25 * atkArgs.AttackData.Target.GetConLevel(atkArgs.AttackData.Attacker));
modifier = Math.Min(300, modifier);
modifier = Math.Max(75, modifier);
double damage = baseDamage * modifier * 0.001; // attack speed is 10 times higher (2.5spd=25)
double damageResisted = damage * target.GetResist(eDamageType.Body) * -0.01;
AttackData ad = new AttackData();
ad.Attacker = attacker;
ad.Target = target;
ad.Damage = (int)(damage + damageResisted);
ad.Modifier = (int)damageResisted;
ad.DamageType = eDamageType.Body;
ad.AttackType = AttackData.eAttackType.MeleeOneHand;
ad.AttackResult = GameLiving.eAttackResult.HitUnstyled;
ad.WeaponSpeed = atkArgs.AttackData.WeaponSpeed;
GamePlayer owner = attacker as GamePlayer;
if (owner != null)
{
owner.Out.SendMessage(LanguageMgr.GetTranslation(owner.Client, "Effects.TripleWieldEffect.MBHitsExtraDamage", target.GetName(0, false), ad.Damage), eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
GamePlayer playerTarget = target as GamePlayer;
if (playerTarget != null)
{
owner.Out.SendMessage(LanguageMgr.GetTranslation(owner.Client, "Effects.TripleWieldEffect.XMBExtraDamageToYou", attacker.GetName(0, false), ad.Damage), eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
}
}
target.OnAttackedByEnemy(ad);
attacker.DealDamage(ad);
foreach (GamePlayer player in ad.Attacker.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
{
player.Out.SendCombatAnimation(null, target, 0, 0, 0, 0, 0x0A, target.HealthPercent);
}
}
示例4: DrainPower
public override void DrainPower(AttackData ad)
{
if ( !(m_caster is NecromancerPet))
return;
base.DrainPower(ad);
}
示例5: DamageTarget
public override void DamageTarget(AttackData ad, bool showEffectAnimation)
{
if(ad.Damage > 0 && ad.Target is GameNPC)
{
if(!(Caster is GamePlayer)) return;
IOldAggressiveBrain aggroBrain = ((GameNPC) ad.Target).Brain as IOldAggressiveBrain;
if(aggroBrain != null)
{
TurretPet turret = null;
if(Caster.TargetObject == null || !Caster.IsControlledNPC(Caster.TargetObject as TurretPet))
{
if(Caster.ControlledBrain != null && Caster.ControlledBrain.Body != null)
{
turret = Caster.ControlledBrain.Body as TurretPet;
}
}
else if(Caster.IsControlledNPC(Caster.TargetObject as TurretPet))
{
turret = Caster.TargetObject as TurretPet;
}
if(turret != null)
{
//pet will take aggro
AttackData turretAd = ad;
turretAd.Attacker = turret;
ad.Target.OnAttackedByEnemy(turretAd);
aggroBrain.AddToAggroList(turret, (ad.Damage + ad.CriticalDamage)*3);
}
aggroBrain.AddToAggroList(Caster, ad.Damage);
}
}
base.DamageTarget(ad, showEffectAnimation);
}
示例6: GenerateID
/// <summary>
/// Utility method to generate attack IDs.
/// </summary>
/// <param name="data">The data to create an id for.</param>
/// <returns>An entirely unique id for the data.</returns>
protected virtual int GenerateID(AttackData data)
{
var id = data.GetHashCode () * 23;
id <<= data.Priority;
id <<= 5;
id *= Time.frameCount;
return id;
}
示例7: Attack
public Attack(AttackData data, int team, int id, float damageMult = 1.00f,
float xKnockbackMult = 1.00f, float yKnockbackMult = 1.00f)
{
kData = data;
kTeam = team;
kId = id;
damageMultiplier = damageMult;
launchScale = new Vector2 (xKnockbackMult, yKnockbackMult);
}
示例8: Attack
public Attack(AttackData atk)
{
this.aName = atk.aName;
this.range = atk.range;
this.dmg = atk.dmg;
this.roll = atk.roll;
this.nDice = atk.nDice;
foreach (DamageType x in atk.dmgTypes)
dmgTypes.Add(x);
}
示例9: Start
void Start()
{
victim.ownerPlayer = Network.player.guid;
var _attackData = new AttackData(100)
{
ownerPlayer = Network.player.guid,
projectile = ProjectileType.RED_BULLET,
weapon = WeaponType.ASSAULT_RIFLE,
};
victim.Hit(_attackData);
bangEntity.Refresh(victim);
}
示例10: SendAttackCoord
public void SendAttackCoord(int charId, float fireForce, Quaternion fireAngle, CharacterCoord fireCoord)
{
if(network != null)
{
// 패킷 데이터 만들기
AttackData data = new AttackData();
data.characterId = charId;
data.fireForce = fireForce;
data.fireAngle = fireAngle;
data.fireCoord = fireCoord;
// 데이터를 UDP송신
AttackPacket packet = new AttackPacket(data);
network.SendUnreliableToAll<AttackData>(packet);
}
}
示例11: StealEndo
/// <summary>
/// Uses percent of damage to renew endurance
/// </summary>
public virtual void StealEndo(AttackData ad)
{
if (ad == null) return;
if (!m_caster.IsAlive) return;
int renew = ((ad.Damage + ad.CriticalDamage) * Spell.ResurrectHealth / 100) * Spell.LifeDrainReturn / 100; // %endo returned
renew = m_caster.ChangeEndurance(m_caster, GameLiving.eEnduranceChangeType.Spell, renew);
if (renew > 0)
{
MessageToCaster("You steal " + renew + " endurance.", eChatType.CT_Spell);
}
else
{
MessageToCaster("You cannot steal any more endurance.", eChatType.CT_SpellResisted);
}
}
示例12: StealLife
/// <summary>
/// Uses percent of damage to heal the caster
/// </summary>
public override void StealLife(AttackData ad)
{
if (ad == null) return;
if (!Caster.IsAlive) return;
int heal = (ad.Damage + ad.CriticalDamage) * 35 / 100;
int mana = (ad.Damage + ad.CriticalDamage) * 21 / 100;
int endu = (ad.Damage + ad.CriticalDamage) * 14 / 100;
if (Caster.IsDiseased)
{
MessageToCaster("You are diseased!", eChatType.CT_SpellResisted);
heal >>= 1;
}
if (heal <= 0) return;
heal = Caster.ChangeHealth(Caster, GameLiving.eHealthChangeType.Spell, heal);
if (heal > 0)
{
MessageToCaster("You drain " + heal + " hit point" + (heal == 1 ? "." : "s."), eChatType.CT_Spell);
}
else
{
MessageToCaster("You cannot absorb any more life.", eChatType.CT_SpellResisted);
}
if (mana <= 0) return;
mana = Caster.ChangeMana(Caster, GameLiving.eManaChangeType.Spell, mana);
if (mana > 0)
{
MessageToCaster("You drain " + mana + " power point" + (mana == 1 ? "." : "s."), eChatType.CT_Spell);
}
else
{
MessageToCaster("You cannot absorb any more power.", eChatType.CT_SpellResisted);
}
if (endu <= 0) return;
endu = Caster.ChangeEndurance(Caster, GameLiving.eEnduranceChangeType.Spell, endu);
if (heal > 0)
{
MessageToCaster("You drain " + endu + " endurance point" + (endu == 1 ? "." : "s."), eChatType.CT_Spell);
}
else
{
MessageToCaster("You cannot absorb any more endurance.", eChatType.CT_SpellResisted);
}
}
示例13: DrainPower
/// <summary>
/// Use a percentage of the damage to refill caster's power.
/// </summary>
/// <param name="ad">Attack data.</param>
public virtual void DrainPower(AttackData ad)
{
if (ad == null || !m_caster.IsAlive)
return;
GameLiving owner = Owner();
if (owner == null)
return;
int powerGain = (ad.Damage + ad.CriticalDamage) * m_spell.LifeDrainReturn / 100;
powerGain = owner.ChangeMana(m_caster, GameLiving.eManaChangeType.Spell, powerGain);
if (powerGain > 0)
MessageToOwner(String.Format("Your summon channels {0} power to you!", powerGain), eChatType.CT_Spell);
else
MessageToOwner("You cannot absorb any more power.", eChatType.CT_SpellResisted);
}
示例14: Damage
public void Damage(AttackData attackData)
{
if (! enabled)
{
// Debug.Log("DamageDetector already disabled!");
return;
}
if (m_DoDamage != null)
{
m_DoDamage(attackData);
}
else
{
Debug.Log("doDamage is not set!");
}
}
示例15: CalculateDamageToTarget
public override AttackData CalculateDamageToTarget( GameLiving target, double effectiveness )
{
int bleedValue = target.TempProperties.getProperty<int>( BLEED_VALUE_PROPERTY);
AttackData ad = new AttackData();
ad.Attacker = Caster;
ad.Target = target;
ad.AttackType = AttackData.eAttackType.Spell;
ad.Modifier = bleedValue * ad.Target.GetResist( Spell.DamageType ) / -100;
ad.Damage = bleedValue + ad.Modifier;
ad.DamageType = Spell.DamageType;
ad.AttackResult = GameLiving.eAttackResult.HitUnstyled;
ad.SpellHandler = this;
ad.CausesCombat = false;
return ad;
}