コード例 #1
0
        /// <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);
        }
コード例 #2
0
 public bool IsImmune(ImmunityType type)
 {
     if (Immunities == null)
     {
         return(false);
     }
     return(Immunities.Contains(type));
 }
コード例 #3
0
        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);
                }
            }
        }
コード例 #4
0
ファイル: Npc.cs プロジェクト: brewsterl/berserker
        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};
        }
コード例 #5
0
ファイル: Effect.Create.cs プロジェクト: jakkn/Anvil
 public static Effect Immunity(ImmunityType immunityType) => NWScript.EffectImmunity((int)immunityType);
コード例 #6
0
ファイル: creature.cs プロジェクト: brewsterl/cyclops
 public bool IsImmune(ImmunityType type)
 {
     if (Immunities == null) {
         return false;
     }
     return Immunities.Contains(type);
 }
コード例 #7
0
ファイル: creature.cs プロジェクト: brewsterl/cyclops
 public override void AppendHandleDamage(int dmgAmt, Creature attacker, ImmunityType type,
     GameWorld world, bool magic)
 {
     world.AppendAddDamage(attacker, this, dmgAmt, type, magic);
 }
コード例 #8
0
ファイル: npc.cs プロジェクト: Wirless/cyclops
 public NPC()
 {
     Immunities = new ImmunityType[]
     { ImmunityType.IMMUNE_ELECTRIC, ImmunityType.IMMUNE_FIRE,
       ImmunityType.IMMUNE_PHYSICAL, ImmunityType.IMMUNE_POISON };
 }
コード例 #9
0
 public static Effect Immunity(ImmunityType immunityType)
 {
     return(NWScript.EffectImmunity((int)immunityType) !);
 }
コード例 #10
0
 public override void AppendHandleDamage(int dmgAmt, Creature attacker, ImmunityType type,
                                         GameWorld world, bool magic)
 {
     world.AppendAddDamage(attacker, this, dmgAmt, type, magic);
 }
コード例 #11
0
ファイル: gameworld.cs プロジェクト: brewsterl/cyclops
        /// <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;
        }
コード例 #12
0
ファイル: gameworld.cs プロジェクト: brewsterl/cyclops
        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);
                }
            }
        }
コード例 #13
0
 public virtual void AppendHandleDamage(int dmgAmt, Creature attacker, ImmunityType type,
                                        GameWorld world, bool magic)
 {
 }