Пример #1
0
 public void clearConversation()
 {
     currentPartner = null;
     currentConversationPartnerName.text = "";
     currentConversationText.text        = "";
     clearResponses();
 }
Пример #2
0
        private static string SaveNPC(Room room, INpc npc)
        {
            int x = npc.Location.X - (int)room.Offset.X;
            int y = npc.Location.Y - (int)room.Offset.Y;

            return("<NPC ObjectName=\"" + npc.ToNPCEnum().GetName() + "\" LocationX=\"" + x + "\" LocationY=\"" + y + "\" />?");
        }
Пример #3
0
    public void setConversationPartner(INpc partner)
    {
        currentPartner = partner;
        currentConversationPartnerName.text = partner.Name;
        currentConversationText.text        = partner.ConversationLines[partner.CurrentLinePtr].line;

        setResponses();
    }
Пример #4
0
 public static void AddPerk(this INpc npc, IFormLink <IPerkGetter> perk, byte rank = 1)
 {
     npc.Perks ??= new ExtendedList <PerkPlacement>();
     npc.Perks.Add(new PerkPlacement
     {
         Perk = perk,
         Rank = rank
     });
 }
Пример #5
0
        protected override void OnStart()
        {
            var npcs = Data.GetNpcsByLocation(Location).ToArray();

            masterPieceSupplyNpc    = npcs.OfType <GameObjects.Npcs.MasterPieceSupply>().FirstOrDefault();
            shopExchangeCurrencyNpc = npcs.OfType <GameObjects.Npcs.ShopExchangeCurrency>().FirstOrDefault();

            ShopPurchases = ShopPurchases ?? new List <ShopPurchase>();
        }
        private void CheckIntersectionAndHandleCollision(INpc npc, IBlock block)
        {
            Rectangle collisionFound = Rectangle.Intersect(npc.GetRectangle(), block.GetRectangle());

            if (!collisionFound.IsEmpty)
            {
                Constants.Direction side = UtilityMethods.GetCollisionDirection(npc.GetRectangle(), block.GetRectangle(), collisionFound);
                handlerDictionary.GetNpcBlockHandler(npc.GetType()).HandleCollision(npc, block, side);
            }
        }
        private void CheckIntersectionAndHandleCollision(IPlayer player, INpc npc)
        {
            Rectangle collisionFound = Rectangle.Intersect(player.GetRectangle(), npc.GetRectangle());

            if (!collisionFound.IsEmpty)
            {
                Constants.Direction side = UtilityMethods.GetCollisionDirection(player.GetRectangle(), npc.GetRectangle(), collisionFound);
                handlerDictionary.GetPlayerNpcHandler(npc.GetType()).HandleCollision(player, npc, side);
            }
        }
        public override void Initiate()
        {
            AILevels ai;

            if (CustomSetAI == AILevels.NULL)
            {
                ai = (AILevels)Npc.Hangar.Ship.AI;
            }
            else
            {
                ai = CustomSetAI;
            }
            switch (ai)
            {
            case AILevels.PASSIVE:
            case AILevels.AGGRESSIVE:
                //if (Npc is Barracuda)
                //{
                //    CurrentNpc = new Kamikaze(this);
                //}
                //else CurrentNpc = new Basic(this);
                CurrentNpc = new Basic(this);
                break;

            case AILevels.GALAXY_GATES:
            case AILevels.INVASION:
                CurrentNpc         = new Aggressive(this);
                Npc.IsRegenerating = false;
                break;

            case AILevels.MOTHERSHIP:
                CurrentNpc = new Mothership(this, World.StorageManager.Ships[81]);
                break;

            case AILevels.DAUGHTER:
                CurrentNpc = new Daughter(this);
                break;

            case AILevels.SPACEBALL:
                CurrentNpc = new SpaceballAI(this);
                break;
            }

            base.Initiate();
            StopController = false;
            Active         = true;

            MovementController.Move(Npc, MovementController.ActualPosition(Npc));
            Checkers.Start();
            if (Npc is EventNpc eventNpc)
            {
                eventNpc.Announce();
            }
        }
 protected override void OnStart()
 {
     if (Location == Locations.Custom)
     {
         freeCompanyChestNpc = this;
     }
     else
     {
         freeCompanyChestNpc = Data.GetNpcsByLocation <GameObjects.Npcs.FreeCompanyChest>(Location).FirstOrDefault();
     }
 }
        private void CheckIntersectionAndHandleCollision(INpc npc, IProjectile projectile)
        {
            Rectangle collisionFound = Rectangle.Intersect(npc.GetRectangle(), projectile.GetRectangle());

            if (!collisionFound.IsEmpty)
            {
                Constants.Direction side = UtilityMethods.GetCollisionDirection(npc.GetRectangle(), projectile.GetRectangle(), collisionFound);
                if (projectile.GetType() == typeof(SwordAttackingProjectile))
                {
                    SwordAttackingProjectile tempProjectile = (SwordAttackingProjectile)projectile;
                    side = tempProjectile.Direction;
                }
                handlerDictionary.GetNpcProjectileHandler(projectile.GetType()).HandleCollision(npc, projectile, side);
            }
        }
Пример #11
0
 public static NPCEnum ToNPCEnum(this INpc npc)
 {
     if (npc is OldPerson oldPerson)
     {
         return(oldPerson.Type);
     }
     if (npc is Merchant merchant)
     {
         return(GetMerchantEnum(merchant));
     }
     if (npc is Flame)
     {
         return(NPCEnum.Flame);
     }
     throw new ArgumentException("Not a valid npc!");
 }
        public Layer GenerateLayer(int layerNumber)
        {
            uint width  = 10;
            uint height = 10;

            INpc[,] npcs   = new INpc[width, height];
            ITile[,] tiles = new ITile[width, height];
            IInteractiveObject[,] objects = new IInteractiveObject[width, height];

            for (var x = 0; x < width; x++)
            {
                for (var y = 0; y < height; y++)
                {
                    tiles[x, y] = new Tile(false);
                    npcs[x, y]  = null;
                }
            }

            return(new MiddelLayer(tiles, npcs, new Position(0, 0), new Position(9, 9), objects));
        }
Пример #13
0
        public DevRoom(Game1 game)
        {
            cooldownFramesLeft = 0;

            worldItemsIndex = obstaclesIndex = 0;
            npcIndex        = 2;

            fireball1 = new Fireball();
            fireball2 = new Fireball();
            fireball3 = new Fireball();
            boomerang = new GoriyaBoomerang();

            worldItems = new List <IWorldItem>
            {
                new DungeonKey(xPosItem, yPosItem),
                new DungeonMap(xPosItem, yPosItem),
                new Rupee(xPosItem, yPosItem),
                new Heart(xPosItem, yPosItem),
                new Triforce(xPosItem, yPosItem),
            };

            obstacles = new List <IObstacle>
            {
                new Statue(xPosItem, yPosItem),
                new Block(xPosBlock, yPosBlock),
                new Statue2(xPosItem, yPosItem),
                new Sand(xPosItem, yPosItem),
                new PlainBlock(xPosItem, yPosItem),
                new Stairs(xPosBlock, yPosBlock)
            };

            npcs = new List <INpc>
            {
                new Boss(xPosNPC, yPosNPC, (Fireball)fireball1, (Fireball)fireball2, (Fireball)fireball3, game),
                new Bat(xPosNPC, yPosNPC, game),
                new Goriya(xPosNPC, yPosNPC, (GoriyaBoomerang)boomerang, game),
                new Gel(xPosNPC, yPosNPC, game),
                new Skeleton(xPosNPC, yPosNPC, game),
                new OldMan(xPosNPC, yPosNPC),
            };
        }
Пример #14
0
        public void In_As_Npc_Test()
        {
            using (GameContext context = CreateContext())
            {
                ICharacter character = context.Character;

                IMap map = TestFactory.CreateMap(character);

                context.Process(new In
                {
                    EntityType = EntityType.Npc,
                    EntityId   = 9326,
                    GameKey    = 3093,
                    Position   = new Vector2D(50, 28),
                    Direction  = Direction.South,
                    Npc        = new In.NpcInfo
                    {
                        HpPercentage = 100,
                        MpPercentage = 100,
                        Faction      = Faction.Neutral,
                        Name         = string.Empty,
                        Owner        = null
                    }
                });

                INpc npc = map.GetEntity <INpc>(EntityType.Npc, 9326);

                Check.That(npc).IsNotNull();
                Check.That(npc.Map).IsNotNull();
                Check.That(npc.MonsterKey).IsEqualTo(3093);
                Check.That(npc.Position).IsEqualTo(new Vector2D(50, 28));
                Check.That(npc.Direction).IsEqualTo(Direction.South);
                Check.That(npc.HpPercentage).IsEqualTo(100);
                Check.That(npc.MpPercentage).IsEqualTo(100);
                Check.That(npc.Name).IsEmpty();

                context.IsEventEmitted <EntitySpawnEvent>(x => x.Entity.Id == 9326 && x.Entity.EntityType == EntityType.Npc && x.Map.Equals(map));
            }
        }
        private void ClockUpdateList(List <INpc> list)
        {
            List <int> indicesToRemove = new List <int>();

            for (int i = 0; i < list.Count; i++)
            {
                INpc item = list[i];
                item.ClockUpdate();
                if (item.SafeToDespawn)
                {
                    if (item.GetType() == typeof(Aquamentus) || item.GetType() == typeof(Skeleton) || item.GetType() == typeof(Goriya) || item.GetType() == typeof(Hand))
                    {
                        itemDropper.DropItem(item.Position);
                    }

                    indicesToRemove.Add(i);
                }
            }

            for (int i = 0; i < indicesToRemove.Count; i++)
            {
                list.RemoveAt(indicesToRemove[i] - i);
            }
        }
        public void HandleCollision(IPlayer link, INpc npc, Direction side)
        {
            if (!link.IsJumping())
            {
                switch (side)
                {
                case Direction.North:
                    link.Pos += new Vector2(0, npc.Location.Bottom - link.Pos.Y);
                    break;

                case Direction.South:
                    link.Pos += new Vector2(0, npc.Location.Top - (link.Pos.Y + linkSize));
                    break;

                case Direction.East:
                    link.Pos += new Vector2(npc.Location.Left - (link.Pos.X + linkSize), 0);
                    break;

                case Direction.West:
                    link.Pos += new Vector2(npc.Location.Right - link.Pos.X, 0);
                    break;
                }
            }
        }
Пример #17
0
		protected override void OnStart()
		{
			var npcs = Data.GetNpcsByLocation(Location).ToArray();

			masterPieceSupplyNpc = npcs.OfType<GameObjects.Npcs.MasterPieceSupply>().FirstOrDefault();
			shopExchangeCurrencyNpc = npcs.OfType<GameObjects.Npcs.ShopExchangeCurrency>().FirstOrDefault();

			ShopPurchases = ShopPurchases ?? new List<ShopPurchase>();
		}
Пример #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NpcCatchEvent"/> class with the specified
 /// <paramref name="npc"/> and <paramref name="player"/>.
 /// </summary>
 /// <param name="npc">The NPC being caught.</param>
 /// <param name="player">The player catching the NPC.</param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="npc"/> or <paramref name="player"/> are <see langword="null"/>.
 /// </exception>
 public NpcCatchEvent(INpc npc, IPlayer player) : base(npc)
 {
     Player = player ?? throw new ArgumentNullException(nameof(player));
 }
Пример #19
0
		public CustomNpc(INpc npc)
			: this(npc.AetheryteId, npc.ZoneId, npc.Location, npc.NpcId, npc.Name) {}
Пример #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NpcKilledEvent"/> class with the specified
 /// <paramref name="npc"/>.
 /// </summary>
 /// <param name="npc">The NPC that was killed.</param>
 /// <exception cref="ArgumentNullException"><paramref name="npc"/> is <see langword="null"/>.</exception>
 public NpcKilledEvent(INpc npc) : base(npc)
 {
 }
Пример #21
0
 public Сannonade(INpc characterController) : base(characterController)
 {
 }
Пример #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NpcDefaultsEvent"/> class with the specified
 /// <paramref name="npc"/>.
 /// </summary>
 /// <param name="npc">The NPC whose defaults are being set.</param>
 /// <exception cref="ArgumentNullException"><paramref name="npc"/> is <see langword="null"/>.</exception>
 public NpcDefaultsEvent(INpc npc) : base(npc)
 {
 }
Пример #23
0
		protected override void OnStart()
		{
			if (Location == Locations.Custom)
			{
				freeCompanyChestNpc = this;
			}
			else
			{
				freeCompanyChestNpc = Data.GetNpcsByLocation<GameObjects.Npcs.FreeCompanyChest>(Location).FirstOrDefault();
			}
		}
Пример #24
0
 protected State(INpc characterController)
 {
     _characterController = characterController;
 }
Пример #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NpcTickEvent"/> class with the specified
 /// <paramref name="npc"/>.
 /// </summary>
 /// <param name="npc">The NPC being ticked.</param>
 /// <exception cref="ArgumentNullException"><paramref name="npc"/> is <see langword="null"/>.</exception>
 public NpcTickEvent(INpc npc) : base(npc)
 {
 }
Пример #26
0
 public void AddNpc(INpc npc)
 {
     if (Npcs.ContainsKey(npc.UID) == false)
     {
         Npcs.Add(npc.UID, npc);
         #region Setting the near coords invalid to avoid unpickable items.
         Floor[npc.X, npc.Y, MapObjectType.InvalidCast, npc] = false;
         if (npc.Mesh / 10 != 108 && (byte)npc.Type < 10)
         {
             ushort X = npc.X, Y = npc.Y;
             foreach (Enums.ConquerAngle angle in Angles)
             {
                 ushort xX = X, yY = Y;
                 UpdateCoordonatesForAngle(ref xX, ref yY, angle);
                 Floor[xX, yY, MapObjectType.InvalidCast, null] = false;
             }
         }
         #endregion
     }
 }
Пример #27
0
 public void Enslave(Character ownedByCharacter, out Slave slave)
 {
     slave      = new Slave(this, ownedByCharacter);
     CurrentNpc = slave;
 }
Пример #28
0
 public CustomNpc(INpc npc)
     : this(npc.AetheryteId, npc.ZoneId, npc.Location, npc.NpcId, npc.Name)
 {
 }
Пример #29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NpcSpawnEvent"/> class with the specified
 /// <paramref name="npc"/>.
 /// </summary>
 /// <param name="npc">The NPC being spawned.</param>
 /// <exception cref="ArgumentNullException"><paramref name="npc"/> is <see langword="null"/>.</exception>
 public NpcSpawnEvent(INpc npc) : base(npc)
 {
 }
Пример #30
0
        public void Removenpc(INpc npc)
        {
            if (Npcs.ContainsKey(npc.UID) == true)
            {

                Npcs.Remove(npc.UID);
                Floor[npc.X, npc.Y, MapObjectType.Npc, npc] = true;

            }
        }
Пример #31
0
 public QueueAttack(INpc characterController) : base(characterController)
 {
 }
Пример #32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NpcLootEvent"/> class with the specified
 /// <paramref name="npc"/>.
 /// </summary>
 /// <param name="npc">The NPC dropping loot.</param>
 /// <exception cref="ArgumentNullException"><paramref name="npc"/> is <see langword="null"/>.</exception>
 public NpcLootEvent(INpc npc) : base(npc)
 {
 }
Пример #33
0
 public void Add(INpc entity)
 {
     npcs.Add((INpc)entity);
 }
Пример #34
0
 public bool AddNpc(long uniqueId, INpc npc)
 {
     return(AddNpc(uniqueId, (T)npc));
 }
Пример #35
0
 public EnemyTakeDamageCommand(INpc npc, CollisionSides side)
 {
     this.npc  = npc;
     this.side = side;
 }