Ejemplo n.º 1
0
        /// <summary>
        /// Place short bang at a shot's position and remove the shot
        /// </summary>
        /// <param name="s">An instance of a shot to convert</param>
        // todo review this. I still don't like it.
        public Bang ConvertShotToBang(IMunition s)
        {
            var result = AddBang(s.Position, BangType.Short);

            s.InstantlyExpire();
            return(result);
        }
        private static void InteractionInvolvesMunition(IMunition munition, IGameObject staticItem)
        {
            EffectOfShot effectOfShot = staticItem.Properties.Get(GameObjectProperties.EffectOfShot);

            if (effectOfShot == EffectOfShot.Impervious)
            {
                munition.InstantlyExpire();
                return;
            }

            if (effectOfShot == EffectOfShot.Injury)
            {
                int energyOfStaticItem = staticItem.Energy;
                staticItem.ReduceEnergy(munition.Energy);

                if (staticItem.IsExtant)
                {
                    staticItem.PlaySound(GameSound.StaticObjectShotAndInjured);
                    GlobalServices.GameState.ConvertShotToBang(munition);
                }
                else
                {
                    var bang = GlobalServices.GameState.AddBang(staticItem.Position, BangType.Short);
                    bang.PlaySound(GameSound.StaticObjectShotAndInjured);
                    if (munition is StandardShot)
                    {
                        munition.InstantlyExpire();
                    }
                    else
                    {
                        munition.ReduceEnergy(energyOfStaticItem);
                    }
                }

                return;
            }

            if (effectOfShot == EffectOfShot.Reflection && munition is IStandardShot standardShot && !standardShot.HasRebounded)
            {
                standardShot.Reverse();
            }
        }
Ejemplo n.º 3
0
 public MonsterShot([NotNull] IMonster monster, [NotNull] IMunition munition)
 {
     this.Monster  = monster ?? throw new ArgumentNullException(nameof(monster));
     this.Munition = munition ?? throw new ArgumentNullException(nameof(munition));
 }