public void clearConversation() { currentPartner = null; currentConversationPartnerName.text = ""; currentConversationText.text = ""; clearResponses(); }
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 + "\" />?"); }
public void setConversationPartner(INpc partner) { currentPartner = partner; currentConversationPartnerName.text = partner.Name; currentConversationText.text = partner.ConversationLines[partner.CurrentLinePtr].line; setResponses(); }
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 }); }
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); } }
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)); }
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), }; }
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; } } }
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>(); }
/// <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)); }
public CustomNpc(INpc npc) : this(npc.AetheryteId, npc.ZoneId, npc.Location, npc.NpcId, npc.Name) {}
/// <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) { }
public Сannonade(INpc characterController) : base(characterController) { }
/// <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) { }
protected override void OnStart() { if (Location == Locations.Custom) { freeCompanyChestNpc = this; } else { freeCompanyChestNpc = Data.GetNpcsByLocation<GameObjects.Npcs.FreeCompanyChest>(Location).FirstOrDefault(); } }
protected State(INpc characterController) { _characterController = characterController; }
/// <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) { }
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 } }
public void Enslave(Character ownedByCharacter, out Slave slave) { slave = new Slave(this, ownedByCharacter); CurrentNpc = slave; }
public CustomNpc(INpc npc) : this(npc.AetheryteId, npc.ZoneId, npc.Location, npc.NpcId, npc.Name) { }
/// <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) { }
public void Removenpc(INpc npc) { if (Npcs.ContainsKey(npc.UID) == true) { Npcs.Remove(npc.UID); Floor[npc.X, npc.Y, MapObjectType.Npc, npc] = true; } }
public QueueAttack(INpc characterController) : base(characterController) { }
/// <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) { }
public void Add(INpc entity) { npcs.Add((INpc)entity); }
public bool AddNpc(long uniqueId, INpc npc) { return(AddNpc(uniqueId, (T)npc)); }
public EnemyTakeDamageCommand(INpc npc, CollisionSides side) { this.npc = npc; this.side = side; }