/// <summary> /// Used for handling posion damage, fire damage, etc. Note: Sends protocol data. /// Returns the new damages to set. /// </summary> /// <param name="creature"></param> private int[] HandleDamageEffectCheck(Creature creature, int[] dmgs, MagicEffect effect, ImmunityType type) { if (!creature.LogedIn || dmgs == null) { return(null); } AddMagicEffect(effect, creature.CurrentPosition); int[] newDmgs = null; int dmg = dmgs[0]; if (dmgs.Length > 1) { newDmgs = new int[dmgs.Length - 1]; for (int i = 1; i < dmgs.Length; i++) { newDmgs[i - 1] = dmgs[i]; } } AppendAddDamage(null, creature, dmg, type, true); SendProtocolMessages(); return(newDmgs); }
public bool IsImmune(ImmunityType type) { if (Immunities == null) { return(false); } return(Immunities.Contains(type)); }
public void AppendAddDamage(Creature attacker, Creature attacked, int dmg, ImmunityType type, bool magic) { lock (lockThis) { if (attacked.IsImmune(type)) { AddMagicEffect(MagicEffect.PUFF, attacked.CurrentPosition); return; } if (magic && (attacker is Player)) { dmg = dmg / 2; } HealthStatus healthStatus = attacked.CurrentHealthStatus; Position pos = attacked.CurrentPosition; attacked.AddDamage(dmg, attacker, magic); if (!magic) { attacker.NotifyOfAttack(); } if (attacked.IsDead()) { Item corpse = Item.CreateItem(attacked.Corpse); AppendAddItem(corpse, attacked.CurrentPosition); attacked.AppendNotifyOfDeath(corpse, gameMap); } if (healthStatus != attacked.CurrentHealthStatus) { UpdateHealthStatus(attacked, pos); } } }
private int talkTicks = 0; //Used to determine delay as to when to say bye message #endregion Fields #region Constructors public NPC() { Immunities = new ImmunityType[] { ImmunityType.IMMUNE_ELECTRIC, ImmunityType.IMMUNE_FIRE, ImmunityType.IMMUNE_PHYSICAL, ImmunityType.IMMUNE_POISON}; }
public static Effect Immunity(ImmunityType immunityType) => NWScript.EffectImmunity((int)immunityType);
public bool IsImmune(ImmunityType type) { if (Immunities == null) { return false; } return Immunities.Contains(type); }
public override void AppendHandleDamage(int dmgAmt, Creature attacker, ImmunityType type, GameWorld world, bool magic) { world.AppendAddDamage(attacker, this, dmgAmt, type, magic); }
public NPC() { Immunities = new ImmunityType[] { ImmunityType.IMMUNE_ELECTRIC, ImmunityType.IMMUNE_FIRE, ImmunityType.IMMUNE_PHYSICAL, ImmunityType.IMMUNE_POISON }; }
public static Effect Immunity(ImmunityType immunityType) { return(NWScript.EffectImmunity((int)immunityType) !); }
/// <summary> /// Used for handling posion damage, fire damage, etc. Note: Sends protocol data. /// Returns the new damages to set. /// </summary> /// <param name="creature"></param> private int[] HandleDamageEffectCheck(Creature creature, int[] dmgs, MagicEffect effect, ImmunityType type) { if (!creature.LogedIn || dmgs == null) { return null; } AddMagicEffect(effect, creature.CurrentPosition); int[] newDmgs = null; int dmg = dmgs[0]; if (dmgs.Length > 1) { newDmgs = new int[dmgs.Length - 1]; for (int i = 1; i < dmgs.Length; i++) { newDmgs[i - 1] = dmgs[i]; } } AppendAddDamage(null, creature, dmg, type, true); SendProtocolMessages(); return newDmgs; }
public virtual void AppendHandleDamage(int dmgAmt, Creature attacker, ImmunityType type, GameWorld world, bool magic) { }