/// <summary> /// Constructs new TakeDamageEventArgs /// </summary> /// <param name="damageSource">The damage source</param> /// <param name="damageType">The damage type</param> /// <param name="damageAmount">The damage amount</param> /// <param name="criticalAmount">The critical damage amount</param> public TakeDamageEventArgs(GameObject damageSource, eDamageType damageType, int damageAmount, int criticalAmount) { m_damageSource = damageSource; m_damageType = damageType; m_damageAmount = damageAmount; m_criticalAmount = criticalAmount; }
/// <summary> /// Constructs new TakeDamageEventArgs /// </summary> /// <param name="damageSource">The damage source</param> /// <param name="damageType">The damage type</param> /// <param name="damageAmount">The damage amount</param> /// <param name="criticalAmount">The critical damage amount</param> public TakeDamageEventArgs(GameObject damageSource, eDamageType damageType, int damageAmount, int criticalAmount) { m_damageSource = damageSource; m_damageType = damageType; m_damageAmount = damageAmount; m_criticalAmount = criticalAmount; }
//===================================================== public void OnHit(eDamageType damage) { if (_currentState != eShieldState.ENABLED) { return; } _health = Mathf.Clamp(_health - Convert.ToInt32(SettingsManager.GetSettingsItem("DAMAGE", (int)damage)), 0, 999999); //Debug.Log( "Shield health: " + _health ); if (_health > 0.0f) { if (ShieldDamagedEvent != null) { ShieldDamagedEvent(); } CurrentState = eShieldState.DAMAGED; } else { CurrentState = eShieldState.DESTROYED; } }
/// <summary> /// Take some amount of damage inflicted by another GameObject. /// </summary> /// <param name="source">The object inflicting the damage.</param> /// <param name="damageType">The type of damage.</param> /// <param name="damageAmount">The amount of damage inflicted.</param> /// <param name="criticalAmount">The critical amount of damage inflicted</param> public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { m_healthPercentOld = HealthPercent; base.TakeDamage(source, damageType, damageAmount, criticalAmount); Brain.Notify(GameObjectEvent.TakeDamage, this, new TakeDamageEventArgs(source, damageType, damageAmount, criticalAmount)); }
/// <summary> /// This living takes damage /// </summary> public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { // If people kill the pet first, the owner summons a new one when attacked. if (Health >= MaxHealth) { m_resummonTime = 0; } base.TakeDamage(source, damageType, damageAmount, criticalAmount); if (!IsAlive) { ReleasePet(); } else if (HealthPercent < PetSummonThreshold) { if (m_pet != null && !m_pet.IsAlive && CurrentRegion.Time > m_resummonTime) { ReleasePet(); } if (m_pet == null) { SummonPet(); } } if (source is GameLiving && m_pet != null && m_pet.IsAlive && !m_pet.InCombat && m_pet.Brain is StandardMobBrain petBrain) { petBrain.AddToAggroList((GameLiving)source, 1); petBrain.Think(); } }
protected void TryDamage(Node target, eDamageType type) { if (target != null && target is IDamageable) { var damageable = target as IDamageable; damageable.Damage(damage, type); } }
public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { if (source is GamePlayer) { damageAmount /= 30; criticalAmount /= 30; } base.TakeDamage(source, damageType, damageAmount, criticalAmount); }
//IDamageable public void Damage(int power, eDamageType type) { switch (type) { default: state.AddStatus(eStatusEffect.INTANGIBLE, 1); TakeDamage(power); break; } }
public void TakeDamage(float amount, eDamageType damageType, WeaponModifiers wpnMods) { amount *= Utils.GetDmgModifier(damageType, Armor); HP.CurrentHP -= amount; HPBar.Percentage = HP.LifeLeftPercentage; if (HP.CurrentHP <= 0) { Die(); } }
public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { //While Sunkaio or Zopureo are live, Aithos will take half the damage you do to him. if (Ianetor.BossList.Contains(Ianetor.Zop) || Ianetor.BossList.Contains(Ianetor.Sun)) { int dmg = (int)Math.Round((decimal)(damageAmount / 2)); damageAmount = dmg; } base.TakeDamage(source, damageType, damageAmount, criticalAmount); }
public sBodyData(StreamReader inputFile) { key = Utils.readInt32(inputFile); unknownBodyValue = Utils.readInt32(inputFile); dtype = (eDamageType)Utils.readInt32(inputFile); dval = Utils.readInt32(inputFile); dvar = Utils.readSingle(inputFile); acache = new sAcache(inputFile); bh = (eBodyHeight)Utils.readInt32(inputFile); bpsd = new sBpsd(inputFile); }
public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { if (!(Health - damageAmount - criticalAmount <= 0)) { base.TakeDamage(source, damageType, damageAmount, criticalAmount); } if (Health < MaxHealth) { Health = MaxHealth; } }
/// <summary> /// Returns the dragon's resist to a given damage type. /// </summary> /// <param name="damageType"></param> /// <returns></returns> public override int GetResist(eDamageType damageType) { // 35% vulnerable to melee, 1% to everything else. switch (damageType) { case eDamageType.Slash : case eDamageType.Crush : case eDamageType.Thrust: return 65 * DragonDifficulty / 100; default: return 99 * DragonDifficulty / 100; } }
/// <summary> /// This methode is override to remove XP system /// </summary> /// <param name="source">the damage source</param> /// <param name="damageType">the damage type</param> /// <param name="damageAmount">the amount of damage</param> /// <param name="criticalAmount">the amount of critical damage</param> public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { //Work around the XP system if (IsAlive) { Health -= (damageAmount + criticalAmount); if (!IsAlive) { Health = 0; Die(source); } } }
public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { GamePlayer player = source as GamePlayer; if (player != null) { if (this.HealthPercent < 50) { Split(player); } } base.TakeDamage(source, damageType, damageAmount, criticalAmount); }
/// <summary> /// This methode is override to remove XP system /// </summary> /// <param name="source">the damage source</param> /// <param name="damageType">the damage type</param> /// <param name="damageAmount">the amount of damage</param> /// <param name="criticalAmount">the amount of critical damage</param> public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { //Work around the XP system if (IsAlive) { Health -= (damageAmount + criticalAmount); if (!IsAlive) { Health = 0; Die(source); } } }
public void Damage(int power, eDamageType type) { if (!state.statusHandler.HasStatus(eStatusEffect.INTANGIBLE)) { switch (type) { default: state.AddStatus(eStatusEffect.INTANGIBLE, 2); TakeDamage(power); break; } } }
public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { // Check if this encounter mob is tethered and if so, ignore any damage done both outside of or too far from it's tether range. if (TetherRange > 100) { // if controlled NPC - do checks for owner instead if (source is GameNPC) { IControlledBrain controlled = ((GameNPC)source).Brain as IControlledBrain; if (controlled != null) { source = controlled.GetPlayerOwner(); } } if (IsOutOfTetherRange) { if (source is GamePlayer) { GamePlayer player = source as GamePlayer; player.Out.SendMessage("The " + Name + " is too far from its encounter area, your damage fails to have an effect on it!", eChatType.CT_Important, eChatLoc.CL_ChatWindow); return; } return; } else { if (IsWithinRadius(source, TetherRange)) { base.TakeDamage(source, damageType, damageAmount, criticalAmount); return; } if (source is GamePlayer) { GamePlayer player = source as GamePlayer; player.Out.SendMessage("You are too far from the " + Name + ", your damage fails to effect it!", eChatType.CT_Important, eChatLoc.CL_ChatWindow); } return; } } else { base.TakeDamage(source, damageType, damageAmount, criticalAmount); } }
public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { base.TakeDamage(source, damageType, damageAmount, criticalAmount); if (ObjectState != eObjectState.Active) { return; } GameLiving t = (GameLiving)source; int range = WorldMgr.GetDistance(this, t); if (range > 500) { m_summonerTarget = t; PickAction(); } }
/// <summary> /// Melee constructor /// </summary> /// <param name="range"></param> /// <param name="attackDelay"></param> /// <param name="damage"></param> /// <param name="projectileType"></param> /// <param name="splash"></param> /// <param name="splashDmgPerc"></param> public WeaponStruct(int range, int attackDelay, float damage, int splash, int splashDmgPerc, eAttackableTargets attackableTargets) { Range = range; AttackDelay = attackDelay; CritChance = 0; CritMultiplier = 2; Damage = damage; ProjectileType = eProjectile.None; Splash = splash; SplashDmgPerc = splashDmgPerc; IsMelee = true; AttackableTargets = attackableTargets; ProjectileSpawnOffset = Common.InvalidVector2; DamageType = eDamageType.Normal; ShootFX = ImpactFX = -1; WeaponModifiers = new WeaponModifiers(); }
public BaseProjectile(Vector2 centerLocation, eProjectile projectileType, bool isTowerProjectile, ITargetable target, float damage, eDamageType damageType, int splash, int splashDmgPerc, int impactFX) { EntityID = Engine.RetrieveNextEntityID(); switch (projectileType) { case eProjectile.None: throw new Exception("Trying to create a bullet with eProjectile.None."); case eProjectile.TestBullet1: Texture = Textures[0]; Velocity = 6f; break; case eProjectile.CannonBall16: Texture = Textures[1]; Velocity = 6f; break; case eProjectile.CannonBall32: Texture = Textures[2]; Velocity = 6f; break; default: throw new CaseStatementMissingException(); } FeetOffset = new Vector2(Texture.Width / 2, Texture.Height); if (isTowerProjectile) { EntityType = eEntityType.TowerProjectile; } else { EntityType = eEntityType.RunnerProjectile; } Target = target; Damage = damage; DamageType = damageType; Splash = splash; SplashDmgPerc = splashDmgPerc; Location = centerLocation - new Vector2(Texture.Width / 2, Texture.Height / 2); ImpactFX = impactFX; }
/// <summary> /// From a great distance, damage does not harm lord /// </summary> /// <param name="source">The source of the damage</param> /// <param name="damageType">The type of the damage</param> /// <param name="damageAmount">The amount of the damage</param> /// <param name="criticalAmount">The critical hit amount of damage</param> public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { int distance = 0; if (Component != null && Component.AbstractKeep != null && Component.AbstractKeep is GameKeep) { distance = 400; } else { distance = 300; } // check to make sure pets and pet casters are in range GamePlayer attacker = null; if (source is GamePlayer) { attacker = source as GamePlayer; } else if (source is GameNPC && (source as GameNPC).Brain != null && (source as GameNPC).Brain is IControlledBrain && ((source as GameNPC).Brain as IControlledBrain).Owner is GamePlayer) { attacker = ((source as GameNPC).Brain as IControlledBrain).Owner as GamePlayer; } if ((attacker != null && IsWithinRadius(attacker, distance) == false) || IsWithinRadius(source, distance) == false) { if (attacker != null) { attacker.Out.SendMessage(Name + " is immune to damage from this range", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow); } return; } if (attacker != null && Component != null && Component.AbstractKeep != null && IsAlive && !GameServer.ServerRules.IsSameRealm(this, attacker, true)) { if (Realm == m_lastRealm && m_lastRealm != eRealm.None) { Component.AbstractKeep.LastAttackedByEnemyTick = CurrentRegion.Time; // light up the keep/tower } } base.TakeDamage(source, damageType, damageAmount, criticalAmount); }
public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { if (!m_openDead && Realm != eRealm.Door) { base.TakeDamage(source, damageType, damageAmount, criticalAmount); double damageDealt = damageAmount + criticalAmount; } GamePlayer attackerPlayer = source as GamePlayer; if (attackerPlayer != null) { if (!m_openDead && Realm != eRealm.Door) { attackerPlayer.Out.SendMessage(LanguageMgr.GetTranslation(attackerPlayer.Client.Account.Language, "GameDoor.NowOpen", Name), eChatType.CT_System, eChatLoc.CL_SystemWindow); } if (!m_openDead && Realm != eRealm.Door) { Health -= damageAmount + criticalAmount; if (!IsAlive) { attackerPlayer.Out.SendMessage(LanguageMgr.GetTranslation(attackerPlayer.Client.Account.Language, "GameDoor.NowOpen", Name), eChatType.CT_System, eChatLoc.CL_SystemWindow); Die(source); m_openDead = true; RegenDoorHealth(); if (Locked == 0) { Open(); } Group attackerGroup = attackerPlayer.Group; if (attackerGroup != null) { foreach (GameLiving living in attackerGroup.GetMembersInTheGroup()) { ((GamePlayer)living).Out.SendMessage(LanguageMgr.GetTranslation(attackerPlayer.Client.Account.Language, "GameDoor.NowOpen", Name), eChatType.CT_System, eChatLoc.CL_SystemWindow); } } } } } }
public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { if (damageAmount > 0) { Component.AbstractKeep.LastAttackedByEnemyTick = CurrentRegion.Time; base.TakeDamage(source, damageType, damageAmount, criticalAmount); // only on hp change if (m_oldHealthPercent != HealthPercent) { m_oldHealthPercent = HealthPercent; foreach (GameClient client in WorldMgr.GetClientsOfRegion(CurrentRegionID)) { client.Out.SendObjectUpdate(this); } } } }
public void SetDamageNumber(UnitCtrl source, UnitCtrl target, int value, eDamageType damageType, eDamageEffectType effectType, bool isCritical, bool isTotal) { string valuestr = value.ToString(); List <Sprite> numbers = new List <Sprite>(); List <Sprite> sprites = number_physical_large; if (damageType == eDamageType.MGC) { sprites = number_magical_large; } for (int i = 0; i < valuestr.Length; i++) { //int num = (int)valuestr[i]; int num = (int)valuestr[i] - 48; numbers.Add(sprites[num]); } Sprite head = null; if (isCritical) { if (damageType == eDamageType.MGC) { head = sprite_critical_magical; } else { head = sprite_critical_physical; } } if (isTotal) { head = damageType == eDamageType.MGC ? sprite_total_magical : sprite_total_physical; } float scale = 1; if (effectType == eDamageEffectType.LARGE) { scale = 2; } Vector3 randomPos = new Vector3(Random.Range(-0.1f, 0.1f), Random.Range(-0.1f, 0.25f), 0); Vector3 pos = target.transform.position + numberPosFix + randomPos; SetPrefabNumber(source, pos, numbers, head, scale); }
/// <summary> /// Make a copy of a spell but change the spell type /// Usefull for customization of spells by providing custom spell handelers /// </summary> /// <param name="spell"></param> /// <param name="spellType"></param> public Spell(Spell spell, string spellType) : base(spell.Name, spell.ID, (ushort)spell.Icon, spell.Level, spell.InternalID) { m_description = spell.Description; m_target = spell.Target; m_spelltype = spellType; // replace SpellType m_range = spell.Range; m_radius = spell.Radius; m_value = spell.Value; m_damage = spell.Damage; m_damageType = spell.DamageType; m_concentration = spell.Concentration; m_duration = spell.Duration; m_frequency = spell.Frequency; m_pulse = spell.Pulse; m_pulse_power = spell.PulsePower; m_power = spell.Power; m_casttime = spell.CastTime; m_recastdelay = spell.RecastDelay; m_reshealth = spell.ResurrectHealth; m_resmana = spell.ResurrectMana; m_lifedrain_return = spell.LifeDrainReturn; m_amnesia_chance = spell.AmnesiaChance; m_message1 = spell.Message1; m_message2 = spell.Message2; m_message3 = spell.Message3; m_message4 = spell.Message4; m_effectID = spell.ClientEffect; m_icon = spell.Icon; m_instrumentRequirement = spell.InstrumentRequirement; m_spellGroup = spell.Group; m_effectGroup = spell.EffectGroup; m_subSpellID = spell.SubSpellID; m_moveCast = spell.MoveCast; m_uninterruptible = spell.Uninterruptible; m_isfocus = spell.IsFocus; m_isprimary = spell.IsPrimary; m_issecondary = spell.IsSecondary; m_allowbolt = spell.AllowBolt; m_sharedtimergroup = spell.SharedTimerGroup; m_minotaurspell = spell.m_minotaurspell; // Params m_paramCache = new Dictionary <string, List <string> >(spell.m_paramCache); }
public Spell(DBSpell dbspell, int requiredLevel, bool minotaur) : base(dbspell.Name, dbspell.SpellID, (ushort)dbspell.Icon, requiredLevel, dbspell.TooltipId) { m_description = dbspell.Description; m_target = dbspell.Target; m_spelltype = dbspell.Type; m_range = dbspell.Range; m_radius = dbspell.Radius; m_value = dbspell.Value; m_damage = dbspell.Damage; m_damageType = (eDamageType)dbspell.DamageType; m_concentration = (byte)dbspell.Concentration; m_duration = dbspell.Duration * 1000; m_frequency = dbspell.Frequency * 100; m_pulse = dbspell.Pulse; m_pulse_power = dbspell.PulsePower; m_power = dbspell.Power; m_casttime = (int)(dbspell.CastTime * 1000); m_recastdelay = dbspell.RecastDelay * 1000; m_reshealth = dbspell.ResurrectHealth; m_resmana = dbspell.ResurrectMana; m_lifedrain_return = dbspell.LifeDrainReturn; m_amnesia_chance = dbspell.AmnesiaChance; m_message1 = dbspell.Message1; m_message2 = dbspell.Message2; m_message3 = dbspell.Message3; m_message4 = dbspell.Message4; m_effectID = (ushort)dbspell.ClientEffect; m_instrumentRequirement = dbspell.InstrumentRequirement; m_spellGroup = dbspell.SpellGroup; m_effectGroup = dbspell.EffectGroup; m_subSpellID = dbspell.SubSpellID; m_moveCast = dbspell.MoveCast; m_uninterruptible = dbspell.Uninterruptible; m_isfocus = dbspell.IsFocus; // warlocks m_isprimary = dbspell.IsPrimary; m_issecondary = dbspell.IsSecondary; m_allowbolt = dbspell.AllowBolt; m_sharedtimergroup = dbspell.SharedTimerGroup; m_minotaurspell = minotaur; // Params this.InitFromCollection <DBSpellXCustomValues>(dbspell.CustomValues, param => param.KeyName, param => param.Value); }
public override bool Parse(Hashtable info) { if (!base.Parse(info)) { return(false); } m_damage = EB.Dot.Integer("damage", info, -1); if (m_damage < 0) { EB.Debug.LogWarning("DamageEffectEvent.Parse: damage is empty {0}", EB.JSON.Stringify(info)); return(false); } m_show = EB.Dot.Integer("show", info, -1); if (m_show < 0) { EB.Debug.LogWarning("DamageEffectEvent.Parse: show is empty {0}", EB.JSON.Stringify(info)); return(false); } // optional m_critical = EB.Dot.Bool("critical", info, false); string damage_type = EB.Dot.String("damageType", info, ""); switch (damage_type) { case "poisoning": m_damageType = eDamageType.Poisoning; break; case "bleeding": m_damageType = eDamageType.Bleeding; break; case "fire": m_damageType = eDamageType.Fire; break; } return(true); }
public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { if (damageAmount > 0) { this.AbstractKeep.LastAttackedByEnemyTick = this.CurrentRegion.Time; base.TakeDamage(source, damageType, damageAmount, criticalAmount); //only on hp change if (m_oldHealthPercent != HealthPercent) { m_oldHealthPercent = HealthPercent; foreach (GameClient client in WorldMgr.GetClientsOfRegion(CurrentRegionID)) { client.Out.SendObjectUpdate(this); client.Out.SendKeepComponentDetailUpdate(this); // I knwo this works, not sure if ObjectUpdate is needed - Tolakram } } } }
public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { //Check if this encounter mob is tethered and if so, ignore any damage done both outside of or too far from it's tether range. if (this.TetherRange > 100) { // if controlled NPC - do checks for owner instead if (source is GameNPC) { IControlledBrain controlled = ((GameNPC)source).Brain as IControlledBrain; if (controlled != null) { source = controlled.GetPlayerOwner(); } } if (IsOutOfTetherRange) { if (source is GamePlayer) { GamePlayer player = source as GamePlayer; player.Out.SendMessage("The " + this.Name + " is too far from its encounter area, your damage fails to have an effect on it!", eChatType.CT_Important, eChatLoc.CL_ChatWindow); return; } return; } else { if (IsWithinRadius(source, this.TetherRange)) { base.TakeDamage(source, damageType, damageAmount, criticalAmount); return; } if (source is GamePlayer) { GamePlayer player = source as GamePlayer; player.Out.SendMessage("You are too far from the " + this.Name + ", your damage fails to effect it!", eChatType.CT_Important, eChatLoc.CL_ChatWindow); } return; } } else base.TakeDamage(source, damageType, damageAmount, criticalAmount); }
public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { //Zop dosn't take damage from direct attacks. //If Someone is trying to damage him directly anyway, he should sick his flames. bool purrosicked = false; foreach (GameNPC purro in Ianetor.PurrosList) { if (!purrosicked) { if (!purro.AttackState) { purro.AddAttacker(source); purro.StartAttack(source); purrosicked = true; //only sick one purro at a time on the attacker each time Zopureo is attacked by someone. } } } }
public virtual void DamageProcess() { //데미지 계산방식(계산식은 나중에 수정할 예정) //1.회피 //2.회피 실패시 데미지를 받는다. (방어력에 따라 감소된 데미지를 받음) float random = Random.Range(0, 10); if (random < _status.avoid) { Debug.Log("Avoid attack"); } else { var damageInfo = _character.GetReceiveDamagedInfo(); int receiveDamage = Mathf.RoundToInt((1 - (_status.armor / 100)) * damageInfo.damagePoint); _curDamagedType = damageInfo.attackType; _character.DecreaseHp(receiveDamage); } //상속받은 클래스에서는 데미지를 받았을 때 어떤 행동을 취할지 오버라이딩 해줘야함 }
//public BaseWeapon(Vector2 centerLoc, int atkDelayInMS, float damage, int range, int critRate, int critMultiplier, int splash, int splashDmgPerc, eProjectile projectileType, IHaveTarget owner, Vector2 projectileSpawnOffset) public BaseWeapon(Vector2 centerLoc, WeaponStruct ws, IHaveTarget owner) { CenterLocation = centerLoc; RoF = new SimpleTimer(ws.AttackDelay); Damage = ws.Damage; DamageType = ws.DamageType; Range = ws.Range; CritRate = ws.CritChance; CritMultiplier = ws.CritMultiplier; Splash = ws.Splash; SplashDmgPerc = ws.SplashDmgPerc; ProjectileType = ws.ProjectileType; Owner = owner; ProjectileSpawnOffset = ws.ProjectileSpawnOffset; ShootFX = ws.ShootFX; ImpactFX = ws.ImpactFX; if (ws.Range >= 96) { IsRanged = true; } }
/// <summary> /// This methode is override to remove XP system /// </summary> /// <param name="source">the damage source</param> /// <param name="damageType">the damage type</param> /// <param name="damageAmount">the amount of damage</param> /// <param name="criticalAmount">the amount of critical damage</param> public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { return; }
/// <summary> /// This method is called whenever this living /// should take damage from some source /// </summary> /// <param name="source">the damage source</param> /// <param name="damageType">the damage type</param> /// <param name="damageAmount">the amount of damage</param> /// <param name="criticalAmount">the amount of critical damage</param> public virtual void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { Notify(GameObjectEvent.TakeDamage, this, new TakeDamageEventArgs(source, damageType, damageAmount, criticalAmount)); }
public Spell(DBSpell dbspell, int requiredLevel, bool minotaur) : base(dbspell.Name, (ushort)dbspell.SpellID, requiredLevel) { m_description = dbspell.Description; m_target = dbspell.Target; m_spelltype = dbspell.Type; m_range = dbspell.Range; m_radius = dbspell.Radius; m_value = dbspell.Value; m_damage = dbspell.Damage; m_damageType = (eDamageType)dbspell.DamageType; m_concentration = (byte)dbspell.Concentration; m_duration = dbspell.Duration * 1000; m_frequency = dbspell.Frequency * 100; m_pulse = dbspell.Pulse; m_pulse_power = dbspell.PulsePower; m_power = dbspell.Power; m_casttime = (int)(dbspell.CastTime * 1000); m_recastdelay = dbspell.RecastDelay * 1000; m_reshealth = dbspell.ResurrectHealth; m_resmana = dbspell.ResurrectMana; m_lifedrain_return = dbspell.LifeDrainReturn; m_amnesia_chance = dbspell.AmnesiaChance; m_message1 = dbspell.Message1; m_message2 = dbspell.Message2; m_message3 = dbspell.Message3; m_message4 = dbspell.Message4; m_effectID = (ushort)dbspell.ClientEffect; m_icon = (ushort)dbspell.Icon; m_instrumentRequirement = dbspell.InstrumentRequirement; m_spellGroup = dbspell.SpellGroup; m_effectGroup = dbspell.EffectGroup; m_subSpellID = dbspell.SubSpellID; m_moveCast = dbspell.MoveCast; m_uninterruptible = dbspell.Uninterruptible; m_isfocus = dbspell.IsFocus; // warlocks m_isprimary = dbspell.IsPrimary; m_issecondary = dbspell.IsSecondary; m_allowbolt = dbspell.AllowBolt; m_sharedtimergroup = dbspell.SharedTimerGroup; m_minotaurspell = minotaur; }
/// <summary> /// From a great distance, damage does not harm lord /// </summary> /// <param name="source">The source of the damage</param> /// <param name="damageType">The type of the damage</param> /// <param name="damageAmount">The amount of the damage</param> /// <param name="criticalAmount">The critical hit amount of damage</param> public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { int distance = 0; if (this.Component != null && this.Component.Keep != null && this.Component.Keep is GameKeep) distance = 400; else distance = 300; // check to make sure pets and pet casters are in range GamePlayer attacker = null; if (source is GamePlayer) { attacker = source as GamePlayer; } else if (source is GameNPC && (source as GameNPC).Brain != null && (source as GameNPC).Brain is IControlledBrain && (((source as GameNPC).Brain as IControlledBrain).Owner) is GamePlayer) { attacker = ((source as GameNPC).Brain as IControlledBrain).Owner as GamePlayer; } if ((attacker != null && IsWithinRadius(attacker, distance) == false) || IsWithinRadius(source, distance) == false) { if (attacker != null) attacker.Out.SendMessage(this.Name + " is immune to damage from this range", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow); return; } if (attacker != null && this.Component != null && this.Component.Keep != null && IsAlive && !GameServer.ServerRules.IsSameRealm(this, attacker, true)) { if (Realm == m_lastRealm && m_lastRealm != eRealm.None) this.Component.Keep.LastAttackedByEnemyTick = CurrentRegion.Time; // light up the keep/tower } base.TakeDamage(source, damageType, damageAmount, criticalAmount); }
/// <summary> /// Take some amount of damage inflicted by another GameObject. /// </summary> /// <param name="source">The object inflicting the damage.</param> /// <param name="damageType">The type of damage.</param> /// <param name="damageAmount">The amount of damage inflicted.</param> /// <param name="criticalAmount">The critical amount of damage inflicted</param> public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { m_healthPercentOld = HealthPercent; base.TakeDamage(source, damageType, damageAmount, criticalAmount); Brain.Notify(GameObjectEvent.TakeDamage, this, new TakeDamageEventArgs(source, damageType, damageAmount, criticalAmount)); }
public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { if (!m_openDead && this.Realm != eRealm.Door) { base.TakeDamage(source, damageType, damageAmount, criticalAmount); double damageDealt = damageAmount + criticalAmount; } GamePlayer attackerPlayer = source as GamePlayer; if (attackerPlayer != null) { if (!m_openDead && this.Realm != eRealm.Door) { attackerPlayer.Out.SendMessage(LanguageMgr.GetTranslation(attackerPlayer.Client, "GameDoor.NowOpen", Name), eChatType.CT_System, eChatLoc.CL_SystemWindow); } if (!m_openDead && this.Realm != eRealm.Door) { Health -= damageAmount + criticalAmount; if (!IsAlive) { attackerPlayer.Out.SendMessage(LanguageMgr.GetTranslation(attackerPlayer.Client, "GameDoor.NowOpen", Name), eChatType.CT_System, eChatLoc.CL_SystemWindow); Die(source); m_openDead = true; RegenDoorHealth(); if (Locked == 0) Open(); Group attackerGroup = attackerPlayer.Group; if (attackerGroup != null) { foreach (GameLiving living in attackerGroup.GetMembersInTheGroup()) { ((GamePlayer)living).Out.SendMessage(LanguageMgr.GetTranslation(attackerPlayer.Client, "GameDoor.NowOpen", Name), eChatType.CT_System, eChatLoc.CL_SystemWindow); } } } } } }
public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { if (damageAmount > 0) { this.Keep.LastAttackedByEnemyTick = this.CurrentRegion.Time; base.TakeDamage(source, damageType, damageAmount, criticalAmount); //only on hp change if (m_oldHealthPercent != HealthPercent) { m_oldHealthPercent = HealthPercent; foreach (GameClient client in WorldMgr.GetClientsOfRegion(CurrentRegionID)) { client.Out.SendObjectUpdate(this); } } } }
public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { if (damageAmount > 0) { this.AbstractKeep.LastAttackedByEnemyTick = this.CurrentRegion.Time; base.TakeDamage(source, damageType, damageAmount, criticalAmount); //only on hp change if (m_oldHealthPercent != HealthPercent) { m_oldHealthPercent = HealthPercent; foreach (GameClient client in WorldMgr.GetClientsOfRegion(CurrentRegionID)) { client.Out.SendObjectUpdate(this); client.Out.SendKeepComponentDetailUpdate(this); // I knwo this works, not sure if ObjectUpdate is needed - Tolakram } } } }
public NpcTemplate( GameNPC mob ) { if (mob == null) throw new ArgumentNullException("data"); m_translationId = mob.TranslationId; m_blockChance = mob.BlockChance; m_race = (ushort)mob.Race; m_bodyType = mob.BodyType; m_charisma = mob.Charisma; m_classType = mob.GetType().ToString(); m_constitution = mob.Constitution; m_dexterity = mob.Dexterity; m_empathy = mob.Empathy; m_equipmentTemplateID = mob.EquipmentTemplateID; m_evadeChance = mob.EvadeChance; m_flags = (ushort)mob.Flags; m_guildName = mob.GuildName; m_examineArticle = mob.ExamineArticle; m_messageArticle = mob.MessageArticle; m_intelligence = mob.Intelligence; m_maxdistance = mob.MaxDistance; m_maxSpeed = (short)mob.MaxSpeedBase; m_meleeDamageType = (eDamageType)mob.MeleeDamageType; m_model = mob.Model.ToString(); m_leftHandSwingChance = mob.LeftHandSwingChance; m_level = mob.Level.ToString(); m_name = mob.Name; m_suffix = mob.Suffix; m_parryChance = mob.ParryChance; m_piety = mob.Piety; m_quickness = mob.Quickness; m_strength = mob.Strength; m_size = mob.Size.ToString(); m_templateId = GetNextFreeTemplateId(); m_tetherRange = mob.TetherRange; m_visibleActiveWeaponSlot = mob.VisibleActiveWeaponSlots; if ( mob.Abilities != null && mob.Abilities.Count > 0 ) { try { if (m_abilities == null) m_abilities = new ArrayList(mob.Abilities.Count); foreach (Ability mobAbility in mob.Abilities.Values) { m_abilities.Add(mobAbility); } } catch (Exception ex) { log.Error("Trapped Error: ", ex); } } if ( mob.Spells != null && mob.Spells.Count > 0 ) { try { if (m_spells == null) m_spells = new ArrayList(mob.Spells.Count); foreach (Spell mobSpell in mob.Spells) { m_spells.Add(mobSpell); } } catch (Exception ex) { log.Error("Trapped Error: ", ex); } } if ( mob.Styles != null && mob.Styles.Count > 0 ) { try { if (m_styles == null) m_styles = new ArrayList(mob.Styles.Count); foreach (Style mobStyle in mob.Styles) { m_styles.Add(mobStyle); } } catch (Exception ex) { log.Error("Trapped Error: ", ex); } } AI.Brain.StandardMobBrain brain = mob.Brain as AI.Brain.StandardMobBrain; if (brain != null) { m_aggroLevel = (byte)brain.AggroLevel; m_aggroRange = brain.AggroRange; } if (string.IsNullOrEmpty(ItemsListTemplateID) == false) { GameMerchant merchant = mob as GameMerchant; if (merchant != null) { merchant.TradeItems = new MerchantTradeItems(ItemsListTemplateID); } } }
/// <summary> /// Constructs a new NpcTemplate /// </summary> /// <param name="data">The source npc template data</param> public NpcTemplate(DBNpcTemplate data) { if (data == null) throw new ArgumentNullException("data"); m_templateId = data.TemplateId; m_translationId = data.TranslationId; m_name = data.Name; m_suffix = data.Suffix; m_classType = data.ClassType; m_guildName = data.GuildName; m_examineArticle = data.ExamineArticle; m_messageArticle = data.MessageArticle; m_model = data.Model; m_size = data.Size; if (m_size == null) m_size = "50"; m_level = data.Level; if (m_level == null) m_level = "0"; m_equipmentTemplateID = data.EquipmentTemplateID; m_itemsListTemplateID = data.ItemsListTemplateID; m_maxSpeed = data.MaxSpeed; m_parryChance = data.ParryChance; m_evadeChance = data.EvadeChance; m_blockChance = data.BlockChance; m_leftHandSwingChance = data.LeftHandSwingChance; m_strength = data.Strength; m_constitution = data.Constitution; m_dexterity = data.Dexterity; m_quickness = data.Quickness; m_intelligence = data.Intelligence; m_piety = data.Piety; m_charisma = data.Charisma; m_empathy = data.Empathy; //Time to add Spells/Styles and Abilties to the templates m_abilities = new ArrayList(); m_spelllines = new ArrayList(); m_spells = new ArrayList(); //Adding the spells to an Arraylist here if (data.Spells != null && data.Spells.Length > 0) { string[] spells = data.Spells.Split(';'); for (int k = 0; k < spells.Length; k++) { int id = int.Parse(spells[k]); Spell sp = SkillBase.GetSpellByID(id); if (sp != null) m_spells.Add(sp); else log.Error("Tried to load a null spell into NPC template " + m_templateId + " spell ID: " + id); } } // Adding Style list to Template NPC m_styles = new ArrayList(); if (data.Styles != null && data.Styles.Length > 0) { string[] styles = data.Styles.Split(';'); for (int i = 0; i < styles.Length; i++) { if (styles[i].Trim().Length == 0) continue; string[] styleAndClass = styles[i].Split('|'); if (styleAndClass.Length != 2) continue; string stylePart = styleAndClass[0].Trim(); string classPart = styleAndClass[1].Trim(); if (stylePart.Length == 0 || classPart.Length == 0) continue; int styleID = int.Parse(stylePart); int classID = int.Parse(classPart); Style style = SkillBase.GetStyleByID(styleID, classID); m_styles.Add(style); } } //Adding Abilities to Template NPC. //Certain Abilities have levels will need to fix that down the road. -Batlas if (data.Abilities != null && data.Abilities.Length > 0) { foreach (string splitab in data.Abilities.SplitCSV()) { string[] ab = splitab.Split('|'); if (splitab.Trim().Length == 0) continue; int id = 1; if (ab.Length>1) id = int.Parse(ab[1]); Ability abil = SkillBase.GetAbility(ab[0], id); if (abil != null) m_abilities.Add(abil); } } m_flags = data.Flags; m_meleeDamageType = (eDamageType)data.MeleeDamageType; if (data.MeleeDamageType == 0) m_meleeDamageType = eDamageType.Slash; m_inventory = data.EquipmentTemplateID; m_aggroLevel = data.AggroLevel; m_aggroRange = data.AggroRange; m_race = (ushort)data.Race; m_bodyType = (ushort)data.BodyType; m_maxdistance = data.MaxDistance; m_tetherRange = data.TetherRange; m_visibleActiveWeaponSlot = data.VisibleWeaponSlots; m_replaceMobValues = data.ReplaceMobValues; }
public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { //While Sunkaio or Zopureo are live, Aithos will take half the damage you do to him. if (Ianetor.BossList.Contains(Ianetor.Zop) || Ianetor.BossList.Contains(Ianetor.Sun)) { int dmg = (int)Math.Round((decimal)(damageAmount / 2)); damageAmount = dmg; } base.TakeDamage(source, damageType, damageAmount, criticalAmount); }
public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { if (source is GamePlayer) { damageAmount /= 30; criticalAmount /= 30; } base.TakeDamage(source, damageType, damageAmount, criticalAmount); }
/// <summary> /// Returns the dragon's resist to a given damage type. /// </summary> /// <param name="damageType"></param> /// <returns></returns> public override int GetResist(eDamageType damageType) { // 35% vulnerable to melee, 1% to everything else. switch (damageType) { case eDamageType.Slash: case eDamageType.Crush: case eDamageType.Thrust: return 65 * DragonDifficulty / 100; default: return 99 * DragonDifficulty / 100; } }
public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { if (source is GamePlayer) { damageAmount = 0; criticalAmount = 0; } if (Health - damageAmount - criticalAmount <= 0) this.Delete(); else Health = Health - damageAmount - criticalAmount; }
public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { //check for Immunity to Magic or Melee damage. #region Immunity if ((this.IsImmuneToMagic) && (damageType == eDamageType.Body || damageType == eDamageType.Cold || damageType == eDamageType.Crush || damageType == eDamageType.Energy || damageType == eDamageType.Heat || damageType == eDamageType.Matter || damageType == eDamageType.Spirit)) { if (source is GamePlayer) { GamePlayer player = source as GamePlayer; player.Out.SendMessage("The " + this.Name + " is immune to magic and your damage fails to effect it!", eChatType.CT_Important, eChatLoc.CL_ChatWindow); return; } return; } if ((this.IsImmuneToMelee) && (damageType == eDamageType.Crush || damageType == eDamageType.Slash || damageType == eDamageType.Thrust || damageType == eDamageType.Natural)) { if (source is GamePlayer) { GamePlayer player = source as GamePlayer; player.Out.SendMessage("The " + this.Name + " is immune to melee and your damage fails to effect it!", eChatType.CT_Important, eChatLoc.CL_ChatWindow); return; } return; } if ((this.IsImmuneToCrush) && (damageType == eDamageType.Crush)) { if (source is GamePlayer) { GamePlayer player = source as GamePlayer; player.Out.SendMessage("The " + this.Name + " is immune to crush and your damage fails to effect it!", eChatType.CT_Important, eChatLoc.CL_ChatWindow); return; } return; } if ((this.IsImmuneToSlash) && (damageType == eDamageType.Slash)) { if (source is GamePlayer) { GamePlayer player = source as GamePlayer; player.Out.SendMessage("The " + this.Name + " is immune to slash and your damage fails to effect it!", eChatType.CT_Important, eChatLoc.CL_ChatWindow); return; } return; } if ((this.IsImmuneToThrust) && (damageType == eDamageType.Thrust)) { if (source is GamePlayer) { GamePlayer player = source as GamePlayer; player.Out.SendMessage("The " + this.Name + " is immune to thrust and your damage fails to effect it!", eChatType.CT_Important, eChatLoc.CL_ChatWindow); return; } return; } if ((this.IsImmuneToBody) && (damageType == eDamageType.Body)) { if (source is GamePlayer) { GamePlayer player = source as GamePlayer; player.Out.SendMessage("The " + this.Name + " is immune to body and your damage fails to effect it!", eChatType.CT_Important, eChatLoc.CL_ChatWindow); return; } return; } if ((this.IsImmuneToCold) && (damageType == eDamageType.Cold)) { if (source is GamePlayer) { GamePlayer player = source as GamePlayer; player.Out.SendMessage("The " + this.Name + " is immune to cold and your damage fails to effect it!", eChatType.CT_Important, eChatLoc.CL_ChatWindow); return; } return; } if ((this.IsImmuneToEnergy) && (damageType == eDamageType.Energy)) { if (source is GamePlayer) { GamePlayer player = source as GamePlayer; player.Out.SendMessage("The " + this.Name + " is immune to energy and your damage fails to effect it!", eChatType.CT_Important, eChatLoc.CL_ChatWindow); return; } return; } if ((this.IsImmuneToHeat) && (damageType == eDamageType.Heat)) { if (source is GamePlayer) { GamePlayer player = source as GamePlayer; player.Out.SendMessage("The " + this.Name + " is immune to heat and your damage fails to effect it!", eChatType.CT_Important, eChatLoc.CL_ChatWindow); return; } return; } if ((this.IsImmuneToMatter) && (damageType == eDamageType.Matter)) { if (source is GamePlayer) { GamePlayer player = source as GamePlayer; player.Out.SendMessage("The " + this.Name + " is immune to matter and your damage fails to effect it!", eChatType.CT_Important, eChatLoc.CL_ChatWindow); return; } return; } if ((this.IsImmuneToSpirit) && (damageType == eDamageType.Spirit)) { if (source is GamePlayer) { GamePlayer player = source as GamePlayer; player.Out.SendMessage("The " + this.Name + " is immune to spirit and your damage fails to effect it!", eChatType.CT_Important, eChatLoc.CL_ChatWindow); return; } return; } #endregion Immunity base.TakeDamage(source, damageType, damageAmount, criticalAmount); }
/// <summary> /// Make a copy of a spell but change the spell type /// Usefull for customization of spells by providing custom spell handelers /// </summary> /// <param name="spell"></param> /// <param name="spellType"></param> public Spell(Spell spell, string spellType) : base(spell.Name, spell.ID, (ushort)spell.Icon, spell.Level, spell.InternalID) { m_description = spell.Description; m_target = spell.Target; m_spelltype = spellType; // replace SpellType m_range = spell.Range; m_radius = spell.Radius; m_value = spell.Value; m_damage = spell.Damage; m_damageType = spell.DamageType; m_concentration = spell.Concentration; m_duration = spell.Duration; m_frequency = spell.Frequency; m_pulse = spell.Pulse; m_pulse_power = spell.PulsePower; m_power = spell.Power; m_casttime = spell.CastTime; m_recastdelay = spell.RecastDelay; m_reshealth = spell.ResurrectHealth; m_resmana = spell.ResurrectMana; m_lifedrain_return = spell.LifeDrainReturn; m_amnesia_chance = spell.AmnesiaChance; m_message1 = spell.Message1; m_message2 = spell.Message2; m_message3 = spell.Message3; m_message4 = spell.Message4; m_effectID = spell.ClientEffect; m_icon = spell.Icon; m_instrumentRequirement = spell.InstrumentRequirement; m_spellGroup = spell.Group; m_effectGroup = spell.EffectGroup; m_subSpellID = spell.SubSpellID; m_moveCast = spell.MoveCast; m_uninterruptible = spell.Uninterruptible; m_isfocus = spell.IsFocus; m_isprimary = spell.IsPrimary; m_issecondary = spell.IsSecondary; m_allowbolt = spell.AllowBolt; m_sharedtimergroup = spell.SharedTimerGroup; m_minotaurspell = spell.m_minotaurspell; // Params m_paramCache = new Dictionary<string, List<string>>(spell.m_paramCache); }
public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { //Zop dosn't take damage from direct attacks. //If Someone is trying to damage him directly anyway, he should sick his flames. bool purrosicked = false; foreach (GameNPC purro in Ianetor.PurrosList) { if (!purrosicked) { if (!purro.AttackState) { purro.AddAttacker(source); purro.StartAttack(source); purrosicked = true; //only sick one purro at a time on the attacker each time Zopureo is attacked by someone. } } } }
public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount) { if (damageType == eDamageType.Slash || damageType == eDamageType.Crush || damageType == eDamageType.Thrust) { damageAmount /= 10; criticalAmount /= 10; } else { damageAmount /= 25; criticalAmount /= 25; } base.TakeDamage(source, damageType, damageAmount, criticalAmount); }
public static string DamageTypeToName(eDamageType damage) { switch (damage) { case eDamageType.Body: return "Body"; case eDamageType.Cold: return "Cold"; case eDamageType.Crush: return "Crush"; case eDamageType.Energy: return "Energy"; case eDamageType.Falling: return "Falling"; case eDamageType.Heat: return "Heat"; case eDamageType.Matter: return "Matter"; case eDamageType.Natural: return "Natural"; case eDamageType.Slash: return "Slash"; case eDamageType.Spirit: return "Spirit"; case eDamageType.Thrust: return "Thrust"; default: return "unknown damagetype " + damage.ToString(); } }
/// <summary> /// Gets the natural armor resist to the give damage type /// </summary> /// <param name="armor"></param> /// <param name="damageType"></param> /// <returns>resist value</returns> public static int GetArmorResist(InventoryItem armor, eDamageType damageType) { if (armor == null) return 0; int realm = armor.Template.Realm - (int)eRealm._First; int armorType = armor.Template.Object_Type - (int)eObjectType._FirstArmor; int damage = damageType - eDamageType._FirstResist; if (realm < 0 || realm > eRealm._LastPlayerRealm - eRealm._First) return 0; if (armorType < 0 || armorType > eObjectType._LastArmor - eObjectType._FirstArmor) return 0; if (damage < 0 || damage > eDamageType._LastResist - eDamageType._FirstResist) return 0; const int realmBits = DAMAGETYPE_BITCOUNT + ARMORTYPE_BITCOUNT; return m_armorResists[(realm << realmBits) | (armorType << DAMAGETYPE_BITCOUNT) | damage]; }