/// <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); } }
/// <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); } }
public Damage(float amount, AttackData attackData, RaycastHit hitLocation, Transform attackerTransform) { HitLocation = hitLocation; Amount = amount; Attacker = attackerTransform; Attack = attackData; }
// Copy constructor public Damage(Damage copyFrom) { HitLocation = copyFrom.HitLocation; Amount = copyFrom.Amount; Attacker = copyFrom.Attacker; Attack = copyFrom.Attack; }
public override void DrainPower(AttackData ad) { if ( !(m_caster is NecromancerPet)) return; base.DrainPower(ad); }
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); }
/// <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; }
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); }
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); }
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); }
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); } }
/// <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); } }
/// <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); } }
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!"); } }
/// <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); }
public override void DamageTarget(AttackData ad, bool showEffectAnimation) { ad.Damage = (int)(ad.Damage * m_effetiveness); base.DamageTarget(ad, showEffectAnimation); if (m_currentTick < m_maxTick) { m_effetiveness -= 0.1; //fetch next target foreach (GamePlayer pl in m_currentSource.GetPlayersInRadius(500)) { if (GameServer.ServerRules.IsAllowedToAttack(Caster,pl,true)){ StartSpell(pl); break; } } } }
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; }
/// <summary> /// Apply the extra aggression /// </summary> /// <param name="ad"></param> /// <param name="showEffectAnimation"></param> /// <param name="attackResult"></param> public override void DamageTarget(AttackData ad, bool showEffectAnimation, int attackResult) { base.DamageTarget(ad, showEffectAnimation, attackResult); if (ad.Target is GameNPC && Spell.Value > 0) { IOldAggressiveBrain aggroBrain = ((GameNPC)ad.Target).Brain as IOldAggressiveBrain; if (aggroBrain != null) { // this amount is a wild guess - Tolakram aggroBrain.AddToAggroList(Caster, Math.Max(1, (int)(Spell.Value * Caster.Level * 0.1))); //log.DebugFormat("Damage: {0}, Taunt Value: {1}, Taunt Amount {2}", ad.Damage, Spell.Value, Math.Max(1, (int)(Spell.Value * Caster.Level * 0.1))); } } m_lastAttackData = ad; }
/// <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; int heal = (ad.Damage + ad.CriticalDamage) * Spell.LifeDrainReturn / 100; // % factor on all drains if (m_caster.IsDiseased) { MessageToCaster("You are diseased!", eChatType.CT_SpellResisted); heal >>= 1; } 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); #region PVP DAMAGE if (m_caster is NecromancerPet && ((m_caster as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() != null || m_caster is GamePlayer) { if (m_caster.DamageRvRMemory > 0) m_caster.DamageRvRMemory -= (long)Math.Max(heal, 0); } #endregion PVP DAMAGE } else { MessageToCaster("You cannot absorb any more life.", eChatType.CT_SpellResisted); #region PVP DAMAGE if (m_caster is NecromancerPet && ((m_caster as NecromancerPet).Brain as IControlledBrain).GetPlayerOwner() != null || m_caster is GamePlayer) { if (m_caster.DamageRvRMemory > 0) m_caster.DamageRvRMemory = 0; //Remise a zéro compteur dommages/heal rps } #endregion PVP DAMAGE } }
private void DamageTarget(GameLiving target, GameLiving caster) { double modifier = 0.5 + (caster.GetModifiedSpecLevel("Soulrending") * 0.01); int basedamage = (int)(250 * modifier); int resist = basedamage * target.GetResist(eDamageType.Spirit) / -100; int damage = basedamage + resist; int heal = (int)(damage * 0.75); int modheal = caster.MaxHealth - caster.Health; if (modheal > heal) modheal = heal; caster.Health += modheal; GamePlayer player = caster as GamePlayer; if (player != null) player.Out.SendMessage("You hit " + target.Name + " for " + damage + "(" + resist + ") points of damage!", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow); if (caster is GamePlayer && modheal > 0) ((GamePlayer)caster).Out.SendMessage("Your Soul Quench returns " + modheal + " lifepoints to you", eChatType.CT_Spell, eChatLoc.CL_SystemWindow); GamePlayer targetPlayer = target as GamePlayer; if (targetPlayer != null) { if (targetPlayer.IsStealthed) targetPlayer.Stealth(false); } foreach (GamePlayer p in target.GetPlayersInRadius(false, WorldMgr.VISIBILITY_DISTANCE)) { p.Out.SendSpellEffectAnimation(caster, target, 1145, 0, false, 1); p.Out.SendCombatAnimation(caster, target, 0, 0, 0, 0, 0x14, target.HealthPercent); } //target.TakeDamage(caster, eDamageType.Spirit, damage, 0); AttackData ad = new AttackData(); ad.AttackResult = GameLiving.eAttackResult.HitUnstyled; ad.Attacker = caster; ad.Target = target; ad.DamageType = eDamageType.Spirit; ad.Damage = damage; target.OnAttackedByEnemy(ad); caster.DealDamage(ad); }
/// <summary> /// Uses percent of damage to power the caster /// </summary> public override void StealLife(AttackData ad) { if (ad == null) return; if (!m_caster.IsAlive) return; int heal = (ad.Damage + ad.CriticalDamage) * m_spell.LifeDrainReturn / 100; // Return the spell power? + % calculated on HP value and caster maxmana double manareturned = m_spell.Power + (heal * m_caster.MaxMana / 100); if (heal <= 0) return; heal = m_caster.ChangeMana(m_caster, GameLiving.eManaChangeType.Spell, (int)manareturned); if (heal > 0) { MessageToCaster("You steal " + heal + " power point" + (heal == 1 ? "." : "s."), eChatType.CT_Spell); } else { MessageToCaster("You cannot absorb any more power.", eChatType.CT_SpellResisted); } }
public override void StealLife(AttackData ad) { if(ad == null) return; GamePlayer player = ((IControlledBrain) ((GamePet) Caster).Brain).GetPlayerOwner(); if(player == null || !player.IsAlive) return; int heal = ((ad.Damage + ad.CriticalDamage)*m_spell.LifeDrainReturn)/100; if(player.IsDiseased) { MessageToLiving(player, "You are diseased !", eChatType.CT_SpellResisted); heal >>= 1; } if(heal <= 0) return; heal = player.ChangeHealth(player, GameLiving.eHealthChangeType.Spell, heal); if(heal > 0) { MessageToLiving(player, "You steal " + heal + " hit point" + (heal == 1 ? "." :"s."), eChatType.CT_Spell); } else { MessageToLiving(player, "You cannot absorb any more life.", eChatType.CT_SpellResisted); } }
private void DamageTarget(GameLiving target, GameLiving caster) { int resist = 251 * target.GetResist(eDamageType.Crush) / -100; int damage = 251 + resist; GamePlayer player = caster as GamePlayer; if (player != null) player.Out.SendMessage("You hit " + target.Name + " for " + damage + "(" + resist + ") points of damage!", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow); GamePlayer targetPlayer = target as GamePlayer; if (targetPlayer != null) { if (targetPlayer.IsStealthed) targetPlayer.Stealth(false); } foreach (GamePlayer p in target.GetPlayersInRadius(false, WorldMgr.VISIBILITY_DISTANCE)) { p.Out.SendSpellEffectAnimation(caster, target, 7043, 0, false, 1); p.Out.SendCombatAnimation(caster, target, 0, 0, 0, 0, 0x14, target.HealthPercent); } //target.TakeDamage(caster, eDamageType.Spirit, damage, 0); AttackData ad = new AttackData(); ad.AttackResult = GameLiving.eAttackResult.HitUnstyled; ad.Attacker = caster; ad.Target = target; ad.DamageType = eDamageType.Crush; ad.Damage = damage; target.OnAttackedByEnemy(ad); caster.DealDamage(ad); if (target.EffectList.GetOfType<WhirlingStaffEffect>() == null) { WhirlingStaffEffect effect = new WhirlingStaffEffect(); effect.Start(target); } }
/// <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; int heal = (ad.Damage + ad.CriticalDamage)* Spell.LifeDrainReturn / 100; // % factor on all drains if (m_caster.IsDiseased) { MessageToCaster("You are diseased!", eChatType.CT_SpellResisted); heal >>= 1; } 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); } }
private void DamageTarget(GameLiving target, GameLiving caster) { int damage = 300; GamePlayer player = caster as GamePlayer; if (player != null) player.Out.SendMessage("You hit " + target.Name + " for " + damage + " points of damage!", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow); GamePlayer targetPlayer = target as GamePlayer; if (targetPlayer != null) { if (targetPlayer.IsStealthed) targetPlayer.Stealth(false); } AttackData ad = new AttackData(); ad.AttackResult = GameLiving.eAttackResult.HitUnstyled; ad.Attacker = caster; ad.Target = target; ad.DamageType = eDamageType.Crush; ad.Damage = damage; target.OnAttackedByEnemy(ad); caster.DealDamage(ad); }
public BasicZerglingRush(BuildOptions buildOptions, MacroData macroData, ActiveUnitData activeUnitData, AttackData attackData, ChatService chatService, MicroTaskData microTaskData, UnitCountService unitCountService) : base(buildOptions, macroData, activeUnitData, attackData, microTaskData, chatService, unitCountService) { }
//applies the pushback force variable of the AttackData to the Rigidbody of this Actor. //multiplies data.force by the direction of the hit, because the actor needs to lunge backward in the opposite direction of the hero’s punch //Lastly, it executes TakeDamage using the AttackData’s attackDamage and hitVector values. public virtual void EvaluateAttackData(AttackData data, Vector3 hitVector, Vector3 hitPoint) { body.AddForce(data.force * hitVector); TakeDamage(data.attackDamage, hitVector, data.knockdown); ShowHitEffects(data.attackDamage, hitPoint); }
private void AnalyzeNormalAttack(AttackData attackData, int attackChain, Actor actor, Vector3 hitPoint, Vector3 hitVector) { actor.EvaluateAttackData(attackData, hitVector, hitPoint); currentAttackChain = attackChain; chainComboTimer = chainComboLimit; }
public override void DealDamageCritical(AttackData data) { DealDamageBoss(); }
public NexusFirstWithForge(BuildOptions buildOptions, MacroData macroData, ActiveUnitData activeUnitData, AttackData attackData, ChatService chatService, ChronoData chronoData, ICounterTransitioner counterTransitioner, UnitCountService unitCountService, MicroTaskData microTaskData) : base(buildOptions, macroData, activeUnitData, attackData, chatService, chronoData, counterTransitioner, unitCountService, microTaskData) { }
/// <summary> /// Init the attack data. If no range is specified for this attack, use the default attack range /// </summary> /// <param name="data"></param> /// <param name="defaultAttackRange"></param> public Attack(AttackData data, float defaultAttackRange) { this.data = data; attackRange = data.attackRange == 0 ? defaultAttackRange : data.attackRange; ResetHitTimers(); }
protected override void OnTick() { GameLiving target = m_boltTarget; GameLiving caster = (GameLiving)m_actionSource; if (target == null || target.CurrentRegionID != caster.CurrentRegionID || target.ObjectState != GameObject.eObjectState.Active || !target.IsAlive) { return; } int power = 0; if (target is GameNPC || target.Mana > 0) { if (target is GameNPC) { power = (int)Math.Round(((double)(target.Level) * (double)(m_handler.Spell.Value) * 2) / 100); } else { power = (int)Math.Round((double)(target.MaxMana) * (((double)m_handler.Spell.Value) / 250)); } if (target.Mana < power) { power = target.Mana; } caster.Mana += power; if (target is GamePlayer) { target.Mana -= power; ((GamePlayer)target).Out.SendMessage(caster.Name + " takes " + power + " power!", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow); } if (caster is GamePlayer) { ((GamePlayer)caster).Out.SendMessage("You receive " + power + " power from " + target.Name + "!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow); } } else { ((GamePlayer)caster).Out.SendMessage("You did not receive any power from " + target.Name + "!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow); } //Place the caster in combat if (target is GamePlayer) { caster.LastAttackTickPvP = caster.CurrentRegion.Time; } else { caster.LastAttackTickPvE = caster.CurrentRegion.Time; } //create the attack data for the bolt AttackData ad = new AttackData(); ad.Attacker = caster; ad.Target = target; ad.DamageType = eDamageType.Heat; ad.AttackType = AttackData.eAttackType.Spell; ad.AttackResult = GameLiving.eAttackResult.HitUnstyled; ad.SpellHandler = m_handler; target.OnAttackedByEnemy(ad); target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, caster); }
public AttackManager(GameObject attackerObj, AttackData attackData) { this.attackerObj = attackerObj; this.attackData = attackData; }
public void SetAttackData(AttackData newData) { attackData = newData; }
public override void DealDamageArmored(AttackData data) { DealDamageBoss(); }
// Check if Melee protected override bool MatchingDamageType(ref AttackData ad) { if (ad == null || (ad.AttackResult == GameLiving.eAttackResult.HitStyle && ad.AttackResult == GameLiving.eAttackResult.HitUnstyled)) return false; if (ad.IsMeleeAttack && ad.AttackType == AttackData.eAttackType.Ranged) return false; return true; }
public void damage(AttackData _attackData) { hp -= _attackData.damage; }
protected override void OnAttackedByEnemy(AttackData ad) { AddToAggroList(ad.Attacker, (ad.Attacker.Level + 1) << 1); }
protected override void EventHandler(DOLEvent e, object sender, EventArgs arguments) { AttackedByEnemyEventArgs args = arguments as AttackedByEnemyEventArgs; if (args == null) { return; } if (args.AttackData.AttackResult != GameLiving.eAttackResult.HitUnstyled && args.AttackData.AttackResult != GameLiving.eAttackResult.HitStyle) { return; } if (!args.AttackData.IsMeleeAttack) { return; } GameLiving attacker = sender as GameLiving; //sender is target of attack, becomes attacker for damage shield if (attacker == null) { return; } if (attacker.ObjectState != GameObject.eObjectState.Active) { return; } if (attacker.IsAlive == false) { return; } GameLiving target = args.AttackData.Attacker; //attacker becomes target for damage shield if (target == null) { return; } if (target.ObjectState != GameObject.eObjectState.Active) { return; } if (target.IsAlive == false) { return; } int spread = m_minDamageSpread; spread += Util.Random(50); double damage = Spell.Damage * target.AttackSpeed(target.AttackWeapon) * spread * 0.00001; double damageResisted = damage * target.GetResist(Spell.DamageType) * -0.01; if (Spell.Damage < 0) { damage = args.AttackData.Damage * Spell.Damage / -100.0; damageResisted = damage * target.GetResist(Spell.DamageType) * -0.01; } AttackData ad = new AttackData(); ad.Attacker = attacker; ad.Target = target; ad.Damage = (int)(damage + damageResisted); ad.Modifier = (int)damageResisted; ad.DamageType = Spell.DamageType; ad.SpellHandler = this; ad.AttackType = AttackData.eAttackType.Spell; ad.AttackResult = GameLiving.eAttackResult.HitUnstyled; GamePlayer owner = null; GameClient attackerClient = null; if (attacker is GamePlayer) { attackerClient = ((GamePlayer)attacker).Client; } if (ad.Attacker is GameNPC) { IControlledBrain brain = ((GameNPC)ad.Attacker).Brain as IControlledBrain; if (brain != null) { owner = brain.GetPlayerOwner(); if (owner != null && owner.ControlledBrain != null && ad.Attacker == owner.ControlledBrain.Body) { MessageToLiving(owner, String.Format(LanguageMgr.GetTranslation(owner.Client, "DamageAddAndShield.EventHandlerDS.YourHitFor"), ad.Attacker.Name, target.GetName(0, false), ad.Damage), eChatType.CT_Spell); } } } else if (attackerClient != null) { MessageToLiving(attacker, String.Format(LanguageMgr.GetTranslation(attackerClient, "DamageAddAndShield.EventHandlerDS.YouHitFor"), target.GetName(0, false), ad.Damage), eChatType.CT_Spell); } GameClient targetClient = null; if (target is GamePlayer) { targetClient = ((GamePlayer)target).Client; } if (targetClient != null) { MessageToLiving(target, String.Format(LanguageMgr.GetTranslation(targetClient, "DamageAddAndShield.EventHandlerDS.DamageToYou"), attacker.GetName(0, false), ad.Damage), eChatType.CT_Spell); } target.OnAttackedByEnemy(ad); attacker.DealDamage(ad); foreach (GamePlayer player in attacker.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE)) { if (player == null) { continue; } player.Out.SendCombatAnimation(null, target, 0, 0, 0, 0, 0x14, target.HealthPercent); } // Log.Debug(String.Format("spell damage: {0}; damage: {1}; resisted damage: {2}; damage type {3}; minSpread {4}.", Spell.Damage, ad.Damage, ad.Modifier, ad.DamageType, m_minDamageSpread)); // Log.Debug(String.Format("dmg {0}; spread: {4}; resDmg: {1}; atkSpeed: {2}; resist: {3}.", damage, damageResisted, target.AttackSpeed(null), ad.Target.GetResist(Spell.DamageType), spread)); }
/// <summary> /// Cancels the currently queued attack /// </summary> void CancelAttack() { m_attack = null; state = State.Normal; }
public void init(GameObject target, AttackData attackData) { this.target = target; this.attackData = attackData; this.targetHealth = target.GetComponentInChildren <HealthBar>().gameObject; }
/// <summary> /// Called by the Animator when an attack's hit frames begin. /// </summary> /// <param name="attack">The data of the attack.</param> public override void Attack(AttackData attack) { m_attack = attack; m_frameTimer = (int)attack.NumberOfFrames; state = State.Attack; }
public void action(AttackData data) { dataObj = data; Begin(); }
protected virtual void OnSpellResist(GameLiving target) { m_lastdamage -= m_lastdamage / 4; SendEffectAnimation(target, 0, false, 0); if (target is GameNPC npc) { if (npc.Brain is IControlledBrain brain) { GamePlayer owner = brain.GetPlayerOwner(); // Worthless checks if (owner != null) { MessageToLiving(owner, $"Your {target.Name} resists the effect!", eChatType.CT_SpellResisted); } } } else { MessageToLiving(target, "You resist the effect!", eChatType.CT_SpellResisted); } MessageToCaster($"{target.GetName(0, true)} resists the effect!", eChatType.CT_SpellResisted); if (Spell.Damage != 0) { // notify target about missed attack for spells with damage AttackData ad = new AttackData { Attacker = Caster, Target = target, AttackType = AttackData.eAttackType.Spell, AttackResult = GameLiving.eAttackResult.Missed, SpellHandler = this }; target.OnAttackedByEnemy(ad); target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster); } else if (Spell.CastTime > 0) { target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster); } if (target is GameNPC gameNpc) { if (gameNpc.Brain is IOldAggressiveBrain aggroBrain) { aggroBrain.AddToAggroList(Caster, 1); } } if (target.Realm == 0 || Caster.Realm == 0) { target.LastAttackedByEnemyTickPvE = target.CurrentRegion.Time; Caster.LastAttackTickPvE = Caster.CurrentRegion.Time; } else { target.LastAttackedByEnemyTickPvP = target.CurrentRegion.Time; Caster.LastAttackTickPvP = Caster.CurrentRegion.Time; } }
public void AnalyzeSpecialAttack(AttackData attackData, Actor actor, Vector3 hitPoints, Vector3 hitVector) { actor.EvaluateAttackData(attackData, hitVector, hitPoints); }
/// <summary> /// Start behave attack /// </summary> /// <param name="behavior"></param> /// <returns></returns> public virtual IEnumerator Start_Attack(AIBehavior behavior) { AttackData attackData = null; float lastScanEndConditionTime = Time.time; while (true) { //If no target is found, do nothing if (Halt || CurrentTarget == null) { yield return(null); continue; } //Get attack data if (behavior.UseRandomAttackData == false) { attackData = Unit.AttackDataDict[behavior.AttackDataName]; } else { string attackDataName = Util.RandomFromArray <string>(behavior.AttackDataNameArray); attackData = Unit.AttackDataDict[attackDataName]; } //if this behavior's end condition matches, end this behavior if ((Time.time - lastScanEndConditionTime) >= behavior.AlterBehaviorInterval) { lastScanEndConditionTime = Time.time; if (CheckAlternateBehaviorCondition(behavior)) { break; } } //Animating attack string AttackAnimationName = attackData.AnimationName; //If can see target, and target distance <= AttackableRange, do this: //1. Face to target //2. Check last attack time against attack interval //3. if #2 pass, animating, send hit message if (this.CanSeeCurrentTarget && CurrentTargetDistance <= attackData.AttackableRange) { if (attackData.LookAtTarget) { transform.LookAt(new Vector3(CurrentTarget.position.x, transform.position.y, CurrentTarget.position.z)); } //If hitTriggerType is HitTriggerType.ByAnimationEvent, the function will be invoked by animation event if (attackData.hitTriggerType == HitTriggerType.ByTime) { SendMessage("_Attack", attackData.Name); } animation.CrossFade(attackData.AnimationName); yield return(new WaitForSeconds(animation[attackData.AnimationName].length)); //If AttackInterrupt = true, means wait for a while, so execute the IdleData if (behavior.AttackInterrupt) { IdleData idleData = this.Unit.IdleDataDict[behavior.IdleDataName]; float interval = Random.Range(behavior.AttackIntervalMin, behavior.AttackIntervalMax); animation.CrossFade(idleData.AnimationName); yield return(new WaitForSeconds(interval)); animation.Stop(idleData.AnimationName); } else { yield return(null); } continue; } //else if can't see target, navigating until CanSeeCurrentTarget = true & within AttackableRange else { MoveData moveData = Unit.MoveDataDict[behavior.MoveDataName]; yield return(StartCoroutine(NavigateToTransform(CurrentTarget, moveData, attackData.AttackableRange, 1))); continue; } yield return(null); } animation.Stop(attackData.AnimationName); StopBehavior(behavior); }
private void AnalyzeSpecialAttack(AttackData attackData, Actor actor, Vector3 hitPoint, Vector3 hitVector) { actor.EvaluateAttackData(attackData, hitVector, hitPoint); chainComboTimer = chainComboLimit; }
protected override 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; } GameLiving target = atkArgs.AttackData.Target; if (target == null) { return; } if (target.ObjectState != GameObject.eObjectState.Active) { return; } if (target.IsAlive == false) { return; } if (target is GameKeepComponent || target is GameKeepDoor) { return; } GameLiving attacker = sender as GameLiving; if (attacker == null) { return; } if (attacker.ObjectState != GameObject.eObjectState.Active) { return; } if (attacker.IsAlive == false) { return; } int spread = m_minDamageSpread; spread += Util.Random(50); double dpsCap = DPSCap(attacker.Level); double dps = IgnoreDamageCap ? Spell.Damage : Math.Min(Spell.Damage, dpsCap); double damage = dps * atkArgs.AttackData.WeaponSpeed * spread * 0.001; // attack speed is 10 times higher (2.5spd=25) double damageResisted = damage * target.GetResist(Spell.DamageType) * -0.01; // log.DebugFormat("dps: {0}, damage: {1}, damageResisted: {2}, minDamageSpread: {3}, spread: {4}", dps, damage, damageResisted, m_minDamageSpread, spread); if (Spell.Damage < 0) { damage = atkArgs.AttackData.Damage * Spell.Damage / -100.0; damageResisted = damage * target.GetResist(Spell.DamageType) * -0.01; } AttackData ad = new AttackData(); ad.Attacker = attacker; ad.Target = target; ad.Damage = (int)(damage + damageResisted); ad.Modifier = (int)damageResisted; ad.DamageType = Spell.DamageType; ad.AttackType = AttackData.eAttackType.Spell; ad.SpellHandler = this; ad.AttackResult = GameLiving.eAttackResult.HitUnstyled; if (ad.Attacker is GameNPC) { IControlledBrain brain = ((GameNPC)ad.Attacker).Brain as IControlledBrain; if (brain != null) { GamePlayer owner = brain.GetPlayerOwner(); if (owner != null) { MessageToLiving(owner, String.Format(LanguageMgr.GetTranslation(owner.Client, "DamageAddAndShield.EventHandlerDA.YourHitFor"), ad.Attacker.Name, target.GetName(0, false), ad.Damage), eChatType.CT_Spell); } } } else { GameClient attackerClient = null; if (attacker is GamePlayer) { attackerClient = ((GamePlayer)attacker).Client; } if (attackerClient != null) { MessageToLiving(attacker, String.Format(LanguageMgr.GetTranslation(attackerClient, "DamageAddAndShield.EventHandlerDA.YouHitExtra"), target.GetName(0, false), ad.Damage), eChatType.CT_Spell); } } GameClient targetClient = null; if (target is GamePlayer) { targetClient = ((GamePlayer)target).Client; } if (targetClient != null) { MessageToLiving(target, String.Format(LanguageMgr.GetTranslation(targetClient, "DamageAddAndShield.EventHandlerDA.DamageToYou"), attacker.GetName(0, false), ad.Damage), eChatType.CT_Spell); } target.OnAttackedByEnemy(ad); attacker.DealDamage(ad); foreach (GamePlayer player in ad.Attacker.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE)) { if (player == null) { continue; } player.Out.SendCombatAnimation(null, target, 0, 0, 0, 0, 0x0A, target.HealthPercent); } }
public override void DealDamageNormal(AttackData data) { DealDamageBoss(); }
public AttackTask(IMicroController microController, TargetingData targetingData, ActiveUnitData activeUnitData, DefenseService defenseService, MacroData macroData, AttackData attackData, TargetingService targetingService, MicroTaskData microTaskData, ArmySplitter armySplitter, EnemyCleanupService enemyCleanupService, float priority) { MicroController = microController; TargetingData = targetingData; ActiveUnitData = activeUnitData; DefenseService = defenseService; MacroData = macroData; AttackData = attackData; TargetingService = targetingService; MicroTaskData = microTaskData; ArmySplitter = armySplitter; EnemyCleanupService = enemyCleanupService; Priority = priority; UnitCommanders = new List <UnitCommander>(); lastFrameTime = 0; Enabled = true; }
/// <summary> /// Handler fired whenever effect target attacks /// </summary> /// <param name="e"></param> /// <param name="sender"></param> /// <param name="arguments"></param> protected override void EventHandler(DOLEvent e, object sender, EventArgs arguments) { if (!(arguments is AttackFinishedEventArgs args) || args.AttackData == null || args.AttackData.AttackType == AttackData.eAttackType.Spell) { return; } AttackData ad = args.AttackData; if (ad.AttackResult != GameLiving.eAttackResult.HitUnstyled && ad.AttackResult != GameLiving.eAttackResult.HitStyle) { return; } int baseChance = Spell.Frequency / 100; if (ad.AttackType == AttackData.eAttackType.MeleeDualWield) { baseChance /= 2; } if (baseChance < 1) { baseChance = 1; } if (ad.Attacker == ad.Attacker as GameNPC) { Spell baseSpell = null; GameNPC pet = ad.Attacker as GameNPC; var procSpells = new List <Spell>(); foreach (Spell spell in pet.Spells) { if (pet.GetSkillDisabledDuration(spell) == 0) { if (spell.SpellType.ToLower() == "offensiveproc") { procSpells.Add(spell); } } } if (procSpells.Count > 0) { baseSpell = procSpells[Util.Random(procSpells.Count - 1)]; } m_procSpell = SkillBase.GetSpellByID((int)baseSpell.Value); } if (Util.Chance(baseChance)) { ISpellHandler handler = ScriptMgr.CreateSpellHandler((GameLiving)sender, m_procSpell, m_procSpellLine); if (handler != null) { switch (m_procSpell.Target.ToLower()) { case "enemy": handler.StartSpell(ad.Target); break; default: handler.StartSpell(ad.Attacker); break; } } } }
public void SendFinalizedAttack(AttackData attack) { }
public virtual void UnderAttack(AttackData attackData) { }
public BowShot(AttackData data, PlayerCharacter parent) : base(data, parent) { }
/// <summary> /// Executes the style of the given player. Prints /// out messages to the player notifying him of his success or failure. /// </summary> /// <param name="living">The living executing the styles</param> /// <param name="attackData"> /// The AttackData that will be modified to contain the /// new damage and the executed style. /// </param> /// <param name="weapon">The weapon used to execute the style</param> /// <returns>true if a style was performed, false if not</returns> public static bool ExecuteStyle(GameLiving living, AttackData attackData, InventoryItem weapon) { //First thing in processors, lock the objects you modify //This way it makes sure the objects are not modified by //several different threads at the same time! GamePlayer player = living as GamePlayer; lock (living) { //Does the player want to execute a style at all? if (attackData.Style == null) return false; if (weapon != null && weapon.Object_Type == (int)eObjectType.Shield) { attackData.AnimationId = (weapon.Hand != 1) ? attackData.Style.Icon : attackData.Style.TwoHandAnimation; // 2h shield? } int fatCost = 0; if (weapon != null) fatCost = CalculateEnduranceCost(living, attackData.Style, weapon.SPD_ABS); //Reduce endurance if styled attack missed switch (attackData.AttackResult) { case GameLiving.eAttackResult.Blocked: case GameLiving.eAttackResult.Evaded: case GameLiving.eAttackResult.Missed: case GameLiving.eAttackResult.Parried: if (player != null) //No mob endu lost yet living.Endurance -= Math.Max(1, fatCost / 2); return false; } //Ignore all other attack results if (attackData.AttackResult != GameLiving.eAttackResult.HitUnstyled && attackData.AttackResult != GameLiving.eAttackResult.HitStyle) return false; //Did primary and backup style fail? if (!CanUseStyle(living, attackData.Style, weapon)) { if (player != null) { // reduce players endurance, full endurance if failed style player.Endurance -= fatCost; //"You must be hidden to perform this style!" //Print a style-fail message player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client, "StyleProcessor.ExecuteStyle.ExecuteFail", attackData.Style.Name), eChatType.CT_YouHit, eChatLoc.CL_SystemWindow); } return false; } else { double effectivness = 1.0; if (attackData.Target is GameNPC && player != null) { IControlledBrain brain = ((GameNPC)attackData.Target).Brain as IControlledBrain; if (brain == null) effectivness *= 2; } //Style worked! Print out some nice info and add the damage! :) //Growth Rate * Style Spec * Effective Speed / Unstyled Damage Cap int styledDamageCap = 0; double factor = 1.0; //critical strike for rogue // from: http://www.classesofcamelot.com/other/styles/Styles.htm //Assassination styles (BS, BS2, PA) work differently than normal styles. //Since these styles can only be used as an opener from stealth, these styles have had the DPS portion coded out //and just add a static damage value. This allows for assassins to use fast weapons and still hit hard with their assassination styles. //Furthermore, since the assassination styles add a static damage amount, faster weapons actually allow for a higher DPS than slower //weapons in this case. Thus, one can debate the benefits of a slow assassination weapon versus a fast one. // //Backstab I Cap = ~5 + Critical Strike Spec * 14 / 3 + Nonstyle Cap //Backstab II Cap = 45 + Critical Strike Spec * 6 + Nonstyle Cap //Perforate Artery Cap = 75 + Critical Strike Spec * 9 + Nonstyle Cap // if (attackData.Target is GameNPC || attackData.Target is GamePlayer) { if (attackData.Style.Name == (LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "StyleProcessor.ExecuteStyle.StyleNameBackstab"))) { factor = (5 + living.GetModifiedSpecLevel(Specs.Critical_Strike) * 14 / 3.0) / living.UnstyledDamageCap(weapon); attackData.StyleDamage = (int)Math.Max(1, attackData.UncappedDamage * factor * ServerProperties.Properties.CS_OPENING_EFFECTIVENESS); styledDamageCap = (int)((5 + (living.GetModifiedSpecLevel(Specs.Critical_Strike) * 14 / 3.0 + living.UnstyledDamageCap(weapon))) * effectivness); } else if (attackData.Style.Name == (LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "StyleProcessor.ExecuteStyle.StyleNameBackstabII"))) { factor = (45 + living.GetModifiedSpecLevel(Specs.Critical_Strike) * 6) / living.UnstyledDamageCap(weapon); attackData.StyleDamage = (int)Math.Max(1, attackData.UncappedDamage * factor * ServerProperties.Properties.CS_OPENING_EFFECTIVENESS); styledDamageCap = (int)((45 + (living.GetModifiedSpecLevel(Specs.Critical_Strike) * 6 + living.UnstyledDamageCap(weapon))) * effectivness); } else if (attackData.Style.Name == (LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "StyleProcessor.ExecuteStyle.StyleNamePerforateArtery"))) { factor = (75 + living.GetModifiedSpecLevel(Specs.Critical_Strike) * 9) / living.UnstyledDamageCap(weapon); attackData.StyleDamage = (int)Math.Max(1, attackData.UncappedDamage * factor * ServerProperties.Properties.CS_OPENING_EFFECTIVENESS); styledDamageCap = (int)((75 + (living.GetModifiedSpecLevel(Specs.Critical_Strike) * 9 + living.UnstyledDamageCap(weapon))) * effectivness); } } if (styledDamageCap == 0) { styledDamageCap = (int)((living.UnstyledDamageCap(weapon) + (attackData.Style.GrowthRate * living.GetModifiedSpecLevel(attackData.Style.Spec) * living.AttackSpeed(weapon) * 0.001)) * effectivness); factor = (attackData.Style.GrowthRate * living.GetModifiedSpecLevel(attackData.Style.Spec) * living.AttackSpeed(weapon) * 0.001) / living.UnstyledDamageCap(weapon); attackData.StyleDamage = (int)Math.Max(attackData.Style.GrowthRate > 0 ? 1 : 0, attackData.UncappedDamage * factor); } attackData.StyleDamage = (int)(attackData.StyleDamage * living.GetModified(eProperty.StyleDamage) / 100.0); //Eden - style absorb bonus int absorb=0; if(attackData.Target is GamePlayer && attackData.Target.GetModified(eProperty.StyleAbsorb) > 0) { absorb=(int)Math.Floor((double)attackData.StyleDamage * ((double)attackData.Target.GetModified(eProperty.StyleAbsorb)/100)); attackData.StyleDamage -= absorb; } //Increase regular damage by styledamage ... like on live servers attackData.Damage += attackData.StyleDamage; // apply styled damage cap attackData.Damage = Math.Min(attackData.Damage, styledDamageCap); if (player != null) { // reduce players endurance player.Endurance -= fatCost; if(absorb > 0) { player.Out.SendMessage("A barrier absorbs " + absorb + " damage!", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow); if(living is GamePlayer) (living as GamePlayer).Out.SendMessage("A barrier absorbs " + absorb + " damage!", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow); } } if (attackData.Style.Procs.Count > 0) { ISpellHandler effect; // If ClassID = 0, use the proc for any class, unless there is also a proc with a ClassID // that matches the player's CharacterClass.ID, or for mobs, the style's ClassID - then use // the class-specific proc instead of the ClassID=0 proc if (!attackData.Style.RandomProc) { List<DBStyleXSpell> procsToExecute = new List<DBStyleXSpell>(); bool onlyExecuteClassSpecific = false; foreach (DBStyleXSpell proc in attackData.Style.Procs) { if (player != null && proc.ClassID == player.CharacterClass.ID) { procsToExecute.Add(proc); onlyExecuteClassSpecific = true; } else if (proc.ClassID == attackData.Style.ClassID || proc.ClassID == 0) { procsToExecute.Add(proc); } } foreach (DBStyleXSpell procToExecute in procsToExecute) { if (onlyExecuteClassSpecific && procToExecute.ClassID == 0) continue; if (Util.Chance(procToExecute.Chance)) { effect = CreateMagicEffect(living, attackData.Target, procToExecute.SpellID); //effect could be null if the SpellID is bigger than ushort if (effect != null) { attackData.StyleEffects.Add(effect); if (attackData.Style.OpeningRequirementType == Style.eOpening.Offensive || attackData.Style.OpeningRequirementType == Style.eOpening.Defensive) { effect.UseMinVariance = true; } } } } } else { //Add one proc randomly int random = Util.Random(attackData.Style.Procs.Count - 1); //effect could be null if the SpellID is bigger than ushort effect = CreateMagicEffect(living, attackData.Target, attackData.Style.Procs[random].SpellID); if (effect != null) { attackData.StyleEffects.Add(effect); if (attackData.Style.OpeningRequirementType == Style.eOpening.Offensive || attackData.Style.OpeningRequirementType == Style.eOpening.Defensive) { effect.UseMinVariance = true; } } } } if (weapon != null) attackData.AnimationId = (weapon.Hand != 1) ? attackData.Style.Icon : attackData.Style.TwoHandAnimation; // special animation for two-hand else if (living.Inventory != null) attackData.AnimationId = (living.Inventory.GetItem(eInventorySlot.RightHandWeapon) != null) ? attackData.Style.Icon : attackData.Style.TwoHandAnimation; // special animation for two-hand else attackData.AnimationId = attackData.Style.Icon; return true; } } }
public static AttackData getAttackData(int type, params object[] args) { // 6~11번은 최대 타겟 거리가 추가됐다. // 최대 타겟 거리는 타겟팅 타입 2번에 사용된다. // 타겟팅 타입 2번은 가장 가까운 적 혹은 에너지가 작은 적을 뜻하는데 // 얘가 나보다 타겟 거리보다 멀면 타겟팅을 할 수 없다. AttackData ad = new AttackData(); ad.type = type; int len = 0; switch (type) { case SHORT_1: //1 len = 0; ad.isShortType = true; break; case SHORT_RANGE_2: //2 len = 3; //데미지범위 최소데미지비율 최대타겟유닛수 ad.isShortType = true; break; case LINE_3: // 3 len = 4; //최대비행거리 비행속도 타입 1이면 그쪽 방향으로... break; case LINE_RANGE_4: // 4 len = 5; //최대비행거리 비행속도 데미지범위 최소데미지비율 최대타겟유닛수 break; case LINE_PASS_5: //5 len = 7; //최대비행거리 비행속도 최대타겟유닛수 이펙트타입 이펙트Z/R // 방향틀기 거리 추가. break; case CURVE_RANGE_6: //6 len = 5; //타임리밋 데미지범위 최소데미지비율 최대타겟유닛수 // 최대 타겟거리 추가. break; case DROP_RANGE_7: // 7 len = 6; //타임리밋 데미지범위 최소데미지비율 최대타겟유닛수 break; case CIRCLE_RANGE_8: // 8 len = 4; //데미지범위 최소데미지비율 최대타겟유닛수 break; case FIXED_EFFECT_9: // 9 len = 5; //최대타겟유닛수 이펙트타입 이펙트Z/R 이펙트X break; // 10 case CONTINUE_FIXED_EFFECT_10: //최대타겟유닛수 지속시간 이펙트타입 이펙트Z/R 이펙트X len = 6; break; //11 case CURVE_AFTER_CONTINUE_FIXED_EFFECT_11: //타임리밋 최대타겟유닛수 지속시간 이펙트타입 이펙트Z/R 이펙트X len = 7; break; // case ATTACH_BULLET_12: // 12 len = 5; // 최대타겟유닛수 지속시간 이펙트타입 이펙트Z/R 이펙트X break; case TIME_BOMB_13: // 13 len = 4; //폭발대기시간 데미지범위 최소데미지비율 최대타겟유닛수 break; case LAND_MINE_14: //14 len = 4; //데미지범위 최소데미지비율 최대타겟유닛수 자연폭발시간 break; //15 case CHAIN_LIGHTING_15: //최대전체거리 최대연결거리A 최대연결거리B 최대연결유닛수 연결딜레이 len = 6; break; case SCREEN_ATTACK_16: // 최대데미지거리 len = 3; break; case METHEO_17: // 타임리밋 데미지범위 최소데미지비율 최대피격유닛수 사선 각도 낙하범위 낙하횟수/간격 len = 7; break; case CHASER_18: // 최대비행거리 비행속도 탄환개수 len = 3; break; } ad.attrOriginal = new Xint[len]; ad.attr = new Xint[len]; for (int i = 0; i < len; ++i) { int v = 0; Util.parseObject(args[i], out v, true, 0); ad.attrOriginal[i] = v; ad.attr[i] = v; } return(ad); }
protected virtual void OnDamageAbsorbed(AttackData ad, int DamageAmount) { }
/// <summary> /// Uses percent of damage to heal the caster /// </summary> public override void StealLife(AttackData ad) { if (ad == null) { return; } if (!m_caster.IsAlive) { return; } int heal = (ad.Damage + ad.CriticalDamage) * 50 / 100; int mana = (ad.Damage + ad.CriticalDamage) * 30 / 100; int endu = (ad.Damage + ad.CriticalDamage) * 20 / 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); } if (mana <= 0) { return; } mana = m_caster.ChangeMana(m_caster, GameLiving.eManaChangeType.Spell, mana); if (mana > 0) { MessageToCaster("You steal " + 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 = m_caster.ChangeEndurance(m_caster, GameLiving.eEnduranceChangeType.Spell, endu); if (heal > 0) { MessageToCaster("You steal " + endu + " endurance point" + (endu == 1 ? "." : "s."), eChatType.CT_Spell); } else { MessageToCaster("You cannot absorb any more endurance.", eChatType.CT_SpellResisted); } }
// Anything is absorbed with this method protected override bool MatchingDamageType(ref AttackData ad) { return true; }
protected override void BringFriends(AttackData ad) { // don't }