public override void OnMonsterDead(Puzzle puzzle, MonsterGroup group) { if (group.Remaining != 0) return; puzzle.GetPlace("Place").OpenAllDoors(); }
public override void OnMonsterDead(Puzzle puzzle, MonsterGroup group) { var dungeon = puzzle.Dungeon; if (group.Name == "Mob1") { // Killed goblins if (group.Remaining == 0) { var leader = dungeon.GetCreators().First(); // You only get the reward keyword if you've failed less // than three times. if (!leader.Keywords.Has("RP_Trefor_Failed_3")) { dungeon.PlayCutscene("RP_Trefor_00_c", cutscene => dungeon.RemoveAllPlayers()); leader.Keywords.Give("RP_Trefor_LifeGuard"); } else { dungeon.PlayCutscene("RP_Trefor_00_d", cutscene => dungeon.RemoveAllPlayers()); } leader.Keywords.Give("RP_Trefor_Complete"); leader.Keywords.Remove("RP_Trefor_Failed_1"); leader.Keywords.Remove("RP_Trefor_Failed_2"); leader.Keywords.Remove("RP_Trefor_Failed_3"); } } // Traveler died else if (group.Name == "Mob2") { var leader = dungeon.GetCreators().First(); if (leader.Keywords.Has("RP_Trefor_Failed_1")) { leader.Keywords.Remove("RP_Trefor_Failed_1"); leader.Keywords.Give("RP_Trefor_Failed_2"); } else if (leader.Keywords.Has("RP_Trefor_Failed_2")) { leader.Keywords.Remove("RP_Trefor_Failed_2"); leader.Keywords.Give("RP_Trefor_Failed_3"); } else if (!leader.Keywords.Has("RP_Trefor_Failed_3")) { leader.Keywords.Give("RP_Trefor_Failed_1"); } dungeon.PlayCutscene("RP_Trefor_00_b", cutscene => dungeon.RemoveAllPlayers()); } }
public MonsterFighter(Fight Fight, MonsterLevel Monster, int MonsterGuid, MonsterGroup MonsterGroup = null, Fighter Invocator = null) : base(Fight, GameActorTypeEnum.TYPE_MONSTER, Invocator) { this.MonsterGroup = MonsterGroup; this.Grade = Monster; base.InitFighter(this.Grade.Stats, MonsterGuid, this.Grade.Monster.Look); if (Invocator != null) { base.InvocatorGiven(Invocator); base.InvokID = Invocator.InvokTotal++; } }
public void RemoveMonsterGroup(WorldClient client, MonsterGroup group) { lock (locker) { this.MonstersGroups.Remove(group); foreach (var otherClients in this.ClientsOnMap.FindAll(x => x.ActiveCharacter.Id != client.ActiveCharacter.Id)) { otherClients.SendPacket(new GameContextRemoveElementMessage(group.Id)); otherClients.SendPacket(new GameContextRemoveElementMessage(client.ActiveCharacter.Id)); } } }
public bool SpawnGroup(MonsterGroup group) { if (group == null) { return(false); } Map.Enter(group); OnGroupSpawned(group); return(true); }
public static void Clear() { monsterGroup = null; playerArmy = null; playerPosition = null; movementPoints = 0; monsterGroups = null; recruitmentCamps = null; day = 0; week = 0; month = 0; state = State.WorldMap; }
void PrepareMonsterGroups() { monsterGroupCount = 8; monsterGroups = new MonsterGroup[8]; monsterGroups[0] = new MonsterGroup(1); monsterGroups[0].armies[0] = new Army(1, 3); monsterGroups[0].id = 0; monsterGroups[1] = new MonsterGroup(1); monsterGroups[1].armies[0] = new Army(1, 3); monsterGroups[1].id = 1; monsterGroups[2] = new MonsterGroup(2); monsterGroups[2].armies[0] = new Army(1, 7); monsterGroups[2].armies[1] = new Army(2, 5); monsterGroups[2].id = 2; monsterGroups[3] = new MonsterGroup(2); monsterGroups[3].armies[0] = new Army(1, 7); monsterGroups[3].armies[1] = new Army(2, 5); monsterGroups[3].id = 3; monsterGroups[4] = new MonsterGroup(3); monsterGroups[4].armies[0] = new Army(1, 11); monsterGroups[4].armies[1] = new Army(2, 9); monsterGroups[4].armies[2] = new Army(1, 11); monsterGroups[4].id = 4; monsterGroups[5] = new MonsterGroup(3); monsterGroups[5].armies[0] = new Army(1, 11); monsterGroups[5].armies[1] = new Army(2, 9); monsterGroups[5].armies[2] = new Army(1, 11); monsterGroups[5].id = 5; monsterGroups[6] = new MonsterGroup(5); monsterGroups[6].armies[0] = new Army(1, 15); monsterGroups[6].armies[1] = new Army(1, 19); monsterGroups[6].armies[2] = new Army(2, 15); monsterGroups[6].armies[3] = new Army(1, 19); monsterGroups[6].armies[4] = new Army(1, 15); monsterGroups[6].id = 6; monsterGroups[7] = new MonsterGroup(5); monsterGroups[7].armies[0] = new Army(1, 15); monsterGroups[7].armies[1] = new Army(1, 19); monsterGroups[7].armies[2] = new Army(2, 15); monsterGroups[7].armies[3] = new Army(1, 19); monsterGroups[7].armies[4] = new Army(1, 15); monsterGroups[7].id = 7; }
public static void StartCombat(MonsterGroup monsters, List <Army> playerArmies) { PersistentData.monsterGroup = monsters; MonsterGroup army = new MonsterGroup(playerArmies.Count); for (int i = 0; i < playerArmies.Count; i++) { army.armies[i] = new Army(playerArmies[i].creatureID, playerArmies[i].count); } PersistentData.playerArmy = army; state = State.EnteringCombat; }
public IEnumerator Scheduler(MonsterGroup previous) { while(null != previous && previous.spawnedMonsters < previous.monsterNo && previous.spawnedMonsters < previousGroupMembersDelay) { yield return new WaitForSeconds(1f); } yield return new WaitForSeconds(groupDelaySeconds); CacheMaxDistance(); for(int i = 0; i < monsterNo; ++i) { SpawnNewMonster(); yield return new WaitForSeconds(monsterDelaySeconds); } }
/// <summary> /// Clear all the fields. /// </summary> public void Reset(bool isFightStarted = false, bool canSayReady = false) { m_Summons.Clear(); Fighters.Clear(); DeadEnnemies.Clear(); Options.Clear(); TotalLaunchBySpell.Clear(); LastTurnLaunchBySpell.Clear(); TotalLaunchByCellBySpell.Clear(); DurationByEffect.Clear(); IsFightStarted = isFightStarted; WaitForReady = (!isFightStarted && canSayReady); followingGroup = null; }
protected virtual void OnGroupSpawned(MonsterGroup group) { lock (this.Spawns) { this.Spawns.Add(group); } this.NextGroup = null; Action <SpawningPoolBase, MonsterGroup> spawned = this.Spawned; if (spawned != null) { spawned(this, group); } }
public void ReadMonsterGroup(ICharacterManager characterManager, MonsterGroup monsterGroup, IDataReader dataReader) { dataReader.Position = 0; for (int r = 0; r < 3; ++r) { for (int c = 0; c < 6; ++c) { uint monsterIndex = dataReader.ReadWord(); monsterGroup.Monsters[c, r] = monsterIndex == 0 ? null : characterManager.GetMonster(monsterIndex); } } }
protected override void OnGroupUnSpawned(MonsterGroup monster) { monster.ExitFight += OnExitFight; lock (m_locker) { if (monster.GroupSize != GroupSize.None) { m_groupsBySize[(int)monster.GroupSize] = null; m_groupsToSpawn.Enqueue(monster.GroupSize); } } base.OnGroupUnSpawned(monster); }
public List <MonsterGroup> FillMonstersGroups() { List <MonsterGroup> groupMonsters = new List <MonsterGroup>(); int actualMonsterGroupSize = this.MonstersGroups != null ? this.MonstersGroups.Count : 0; for (int i = actualMonsterGroupSize; i < this.MonsterGroupsLimit; i++) { var group = new MonsterGroup(this); if (group.Monsters.Count != 0) { groupMonsters.Add(group); } } return(groupMonsters); }
public static MonsterGroup Serdes(int _, MonsterGroup m, AssetMapping mapping, ISerializer s) { if (s == null) { throw new ArgumentNullException(nameof(s)); } m ??= new MonsterGroup(); for (int i = 0; i < m.Grid.Length; i++) { m.Grid[i] = MonsterId.SerdesU8( i.ToString(CultureInfo.InvariantCulture), m.Grid[i], mapping, s); s.UInt8(null, 0); } return(m); }
public bool SpawnNextGroup() { MonsterGroup monsterGroup = this.DequeueNextGroupToSpawn(); bool result; if (monsterGroup == null) { result = false; } else { this.Map.Enter(monsterGroup); this.OnGroupSpawned(monsterGroup); result = true; } return(result); }
protected override MonsterGroup DequeueNextGroupToSpawn() { MonsterGroup result; if (!base.Map.CanSpawnMonsters()) { base.StopAutoSpawn(); result = null; } else { lock (this.m_locker) { if (this.m_spawnsQueue.Count == 0) { DungeonSpawningPool.logger.Error("SpawningPool Map = {0} try to spawn a monser group but m_groupsToSpawn is empty", base.Map.Id); result = null; } else { MonsterDungeonSpawn monsterDungeonSpawn = this.m_spawnsQueue.Dequeue(); MonsterGroup monsterGroup = new MonsterGroup(base.Map.GetNextContextualId(), new ObjectPosition(base.Map, base.Map.GetRandomFreeCell(false), base.Map.GetRandomDirection())); foreach (MonsterDungeonSpawnEntity current in monsterDungeonSpawn.GroupMonsters) { var monster = current.GenerateMonster(ref monsterGroup); if (monster != null) { monsterGroup.AddMonster(monster); } } if (monsterGroup.GetMonsters().Count() == 0) { DungeonSpawningPool.logger.Error("SpawningPool Map = {0} try to spawn a monser group but MonsterGroup is empty", base.Map.Id); result = null; } else { this.m_groupsSpawn.Add(monsterGroup, monsterDungeonSpawn); result = monsterGroup; } } } } return(result); }
private void E_SpawnMonsterGroups(object data) { MonsterGroup Group = data as MonsterGroup; for (int i = 2; i < Grid.Length; i += 2) { if ((i) / 2 - 1 != Group.monsterID) { Grid[i].gameObject.SetActive(false); } else { Grid[i].gameObject.SetActive(true); Grid[i + 1].GetComponent <Text>().text = "X " + Group.count; } } Round_An.SetTrigger("StartRound"); }
public void APIStartMonsterBattle(int battleCell, string pattern) { MonsterGroup group = new MonsterGroup() { CellID = battleCell, }; foreach (var monster in pattern.Split('|')) { if (monster.Trim() != string.Empty) { var data = monster.Trim().Split(','); var m = MonsterHelper.GetMonsterTemplate(int.Parse(data[0])).GetLevel(int.Parse(data[1])); group.AddMonster(m); } } Handlers.GameHandler.StartMonstersBattle(this, group); }
/// <summary> /// Spawn un groupe fixe de mobs /// </summary> /// <param name="instance"></param> /// <param name="monsterRecords"></param> /// <param name="quiet"></param> public void AddFixedMonsterGroup(AbstractMapInstance instance, MonsterRecord[] monsterRecords, bool quiet) { MonsterGroup group = new MonsterGroup(instance.Record); foreach (var template in monsterRecords) { Monster monster = new Monster(template, group); group.AddMonster(monster); } if (quiet) { instance.AddQuietEntity(group); } else { instance.AddEntity(group); } }
protected override void OnGroupUnSpawned(MonsterGroup monster) { lock (this.m_locker) { if (!this.m_groupsSpawn.ContainsKey(monster)) { DungeonSpawningPool.logger.Error <int, int>("Group {0} (Map {1}) was not bind to a dungeon spawn", monster.Id, base.Map.Id); } else { MonsterDungeonSpawn item = this.m_groupsSpawn[monster]; if (this.m_spawns.Contains(item)) { this.m_spawnsQueue.Enqueue(item); } } } base.OnGroupUnSpawned(monster); }
protected virtual void Start() { group = GetComponent <MonsterGroup>(); //Debug.Log("GROUP IS NULL: " + (group == null) + " CHILD COUNT " + transform.childCount.ToString()); if (group != null) { for (int i = 0; i < this.transform.childCount; i++) { GameObject child = transform.GetChild(i).gameObject; Monster monst = child.GetComponent <Monster>(); //Debug.Log(this.name +" Group: "+ group+" Child: "+ child + "\t Monst: " + monst + " "+(i+1).ToString()+ "/" + this.transform.childCount.ToString()); group.AddMonster(monst); } } else { Debug.LogError("GROUP IS NULL!"); } }
public CharacterManager(IGameData gameData, IGraphicProvider graphicProvider) { var npcReader = new NPCReader(); var monsterReader = new MonsterReader(gameData, graphicProvider); var monsterGroupReader = new MonsterGroupReader(); foreach (var npcFile in gameData.Files["NPC_char.amb"].Files) { npcs.Add((uint)npcFile.Key, NPC.Load((uint)npcFile.Key, npcReader, npcFile.Value, gameData.Files["NPC_texts.amb"].Files[npcFile.Key])); } foreach (var monsterFile in gameData.Files["Monster_char_data.amb"].Files) { monsters.Add((uint)monsterFile.Key, Monster.Load((uint)monsterFile.Key, monsterReader, monsterFile.Value)); } foreach (var monsterGroupFile in gameData.Files["Monster_groups.amb"].Files) // load after monsters! { monsterGroups.Add((uint)monsterGroupFile.Key, MonsterGroup.Load(this, monsterGroupReader, monsterGroupFile.Value)); } }
/// <summary> /// 协程:运行一个回合 /// </summary> /// <returns></returns> IEnumerator RunRound() { //回合开始 yield return(new WaitForSeconds(ROUND_INTERVAL)); StartRoundArgs e = new StartRoundArgs { RoundIndex = m_RoundIndex, RoundTotal = RoundTotal, MonsterTotal = m_Rounds[m_RoundIndex].TotalMonster }; Debug.Log("回合开始"); SendEvent(Consts.E_StartRound, e);//发送一个回合开始的事件 List <MonsterGroup> round = m_Rounds[m_RoundIndex].TheRound; SpawnMonsterArgs x = new SpawnMonsterArgs(); for (int k = 0; k < round.Count; k++) { MonsterGroup group = round[k]; SendEvent(Consts.E_SpawnMonsterGroups, group);//发送一个显示怪物群的消息 for (int j = 0; j < group.count; j++) { //出怪间隙 yield return(new WaitForSeconds(SPAWN_INTERVAL)); //出怪事件 x.MonsterID = group.monsterID; //Debug.Log("生成怪物"+ group.monsterID); if (x == null) { Debug.Log("x无效"); } else { SendEvent(Consts.E_SpawnMonster, x); //发送一个生成怪物的命令 } } } m_RoundIndex++; }
public void StartBattle(MonsterGroup mg) { float camheight = Camera.main.orthographicSize * 2.0f; float camwidth = Camera.main.aspect * camheight; float camx = Camera.main.transform.position.x - camwidth / 2; float camy = Camera.main.transform.position.y + camheight / 2; float namewidth = 32.0f * 8.0f; float nameheight = 32.0f * 3.0f; background = new SpriteObject("WhiteBlock"); background.SetPosition(camx, camy); background.SetScale(camwidth / 32, camheight / 32); background.SetColor(0f, 0f, 0f, .95f); player_tags.Clear(); monster_tags.Clear(); monster_group = mg; turn_delay = 0; for (int i = 0; i < Party.party_list.Count; i++) { PlayerCharacter pc = Party.party_list[i]; player_tags.Add(new Nametag(pc)); player_tags[i].SetMessageDetails("player", i); player_tags[i].SetText(pc.name); player_tags[i].SetPosition(camx + (camwidth / 2) + (i-2) * namewidth, camy - camheight + nameheight); player_tags[i].SetScale(8.0f, 3.0f); } for (int i = 0; i < mg.monsters.Count; i++) { Monster m = mg.monsters[i]; monster_tags.Add(new Nametag(m)); monster_tags[i].SetMessageDetails("monster", i); monster_tags[i].SetText(m.name); monster_tags[i].SetPosition(camx + (camwidth / 2) - (mg.monsters.Count * namewidth / 2) + i * namewidth, camy); monster_tags[i].SetScale(8.0f, 3.0f); } }
public override void OnMonsterDead(Puzzle puzzle, MonsterGroup group) { if (group.Remaining != 0) return; var chestPlace = puzzle.GetPlace("ChestPlace"); if (group.Name == "ChainMob1") { chestPlace.SpawnSingleMob("ChainMob2", "Mob2"); } else if (group.Name == "ChainMob2") { chestPlace.SpawnSingleMob("LastMob", "Mob3"); } else if (group.Name == "LastMob") { puzzle.GetPlace("ChestPlace").OpenAllDoors(); } }
void PregenerateArmies() { MonsterGroup monsters = new MonsterGroup(5); monsters.armies[0] = new Army(1, 15); monsters.armies[1] = new Army(1, 19); monsters.armies[2] = new Army(2, 15); monsters.armies[3] = new Army(1, 19); monsters.armies[4] = new Army(1, 15); PersistentData.monsterGroup = monsters; MonsterGroup player = new MonsterGroup(5); player.armies[0] = new Army(0, 20); player.armies[1] = new Army(0, 20); player.armies[2] = new Army(0, 20); player.armies[3] = new Army(0, 20); player.armies[4] = new Army(0, 20); PersistentData.playerArmy = player; }
protected override void OnGroupUnSpawned(MonsterGroup monster) { lock (m_locker) { if (!m_groupsSpawn.ContainsKey(monster)) { logger.Error("Group {0} (Map {1}) was not bind to a dungeon spawn", monster.Id, Map.Id); } else { var spawn = m_groupsSpawn[monster]; if (m_spawns.Contains(spawn)) { m_spawnsQueue.Enqueue(spawn); } } } base.OnGroupUnSpawned(monster); }
public virtual void MonsterKill(Monster monster, Monster monsterEnemy) { // find next monster to attack //monster.Follow(transform); // change this??? //Debug.Log("MONSTERKILL: IS IN MONSTER GROUP? " + (monster.GetGroup() == this)); //Debug.Log("monster is null: " + (monster == null) + " monsterEnemy is null: " + (monsterEnemy == null)); //Debug.Log(monster.name + " KILLED ENEMY!!! NEXT TARGET..."); if (enemyGroup != null) { if (enemyGroup.Count == 0) { //Debug.Log(monster.name + ": ENEMY COUNT AT 0!!!"); inCombat = false; enemyGroup = null; //monster.Follow(transform); //Follow(transform); Follow(followTarget); } else { //Debug.Log(monster.name + ": FINDING NEXT ENEMY"); //will change states in monster script//monster.Follow(transform); Monster enemyFound = monster.ChooseEnemy(enemyGroup.GetMonsters()); //if (enemyFound == null) //{ // UnityEditor.EditorApplication.isPlaying = false; // throw new System.Exception("you dun goofed"); //} } } else { Follow(followTarget); // temp solution, pls fix } }
protected override void OnGroupUnSpawned(MonsterGroup monster) { lock (this.m_locker) { if (monster == this.SmallGroup) { this.m_groupsBySize[0] = null; this.m_groupsToSpawn.Enqueue(ClassicalSpawningPool.GroupSize.Small); } if (monster == this.MediumGroup) { this.m_groupsBySize[1] = null; this.m_groupsToSpawn.Enqueue(ClassicalSpawningPool.GroupSize.Medium); } if (monster == this.BigGroup) { this.m_groupsBySize[2] = null; this.m_groupsToSpawn.Enqueue(ClassicalSpawningPool.GroupSize.Big); } } base.OnGroupUnSpawned(monster); }
void OnExitFight(MonsterGroup monster, IFight fight) { FightMonsterTeam team; if (fight.DefendersTeam is FightMonsterTeam) { team = (FightMonsterTeam)fight.DefendersTeam; } else if (fight.ChallengersTeam is FightMonsterTeam) { team = (FightMonsterTeam)fight.ChallengersTeam; } else { return; } if (fight.Winners == team) // respawn the group { RespawnGroup(monster); } }
public override void OnMonsterDead(Puzzle puzzle, MonsterGroup group) { if (group.Remaining != 0) { return; } var chestPlace = puzzle.GetPlace("ChestPlace"); if (group.Name == "ChainMob1") { chestPlace.SpawnSingleMob("ChainMob2", "Mob2"); } else if (group.Name == "ChainMob2") { chestPlace.SpawnSingleMob("LastMob", "Mob3"); } else if (group.Name == "LastMob") { puzzle.GetPlace("ChestPlace").OpenAllDoors(); } }
public bool SearchFight() { m_Account.Path.Stop = true; int minNumber = (int)m_Account.nudMinMonstersNumber.Value; int maxNumber = (int)m_Account.nudMaxMonstersNumber.Value; int minLevel = (int)m_Account.nudMinMonstersLevel.Value; int maxLevel = (int)m_Account.nudMaxMonstersLevel.Value; lock (this.clock) { foreach (MonsterGroup monsters in m_Account.Map.List) { if (monsters.monstersCount < minNumber || monsters.monstersCount > maxNumber) { continue; } if (monsters.monstersLevel < minLevel || monsters.monstersLevel > maxLevel) { continue; } if (m_Account.VerifGroup(monsters.NameList()) == false) { continue; } this.followinggroup = monsters; if (m_Account.Map.MoveToCell(monsters.m_cellId)) { m_Account.SetStatus(Status.Moving); m_Account.Path.Stop = true; m_Account.Log(new ActionTextInformation(string.Format("Lancement d'un combat contre {0} monstres de niveau {1} ({2})", monsters.monstersCount, monsters.monstersLevel, monsters.monstersName(true))), 1); return(true); } } } return(false); }
public override void OnMonsterDead(Puzzle puzzle, MonsterGroup group) { var dungeon = puzzle.Dungeon; if (group.Name == "Mob1") { if (group.Remaining == 0) { dungeon.PlayCutscene("G1_25_b_3WarriorsRP2", cutscene => { var lockedPlace = puzzle.GetPlace("LockedPlace"); lockedPlace.SpawnSingleMob("Mob2", 7, 1); // Dark Lord var darkLordGroup = puzzle.GetMonsterGroup("Mob2"); darkLordGroup.AddKeyForLock(lockedPlace); }); } } else { dungeon.PlayCutscene("G1_25_c_3WarriorsRP2"); } }
static void MoveGroup(MapRecord map,MonsterGroup group) { var random = new AsyncRandom(); var info = MonsterGroup.GetActorInformations(map, group); List<short> cells = Pathfinding.GetCircleCells(info.disposition.cellId, MoveCellsCount); cells.Remove(info.disposition.cellId); cells.RemoveAll(x => !map.WalkableCells.Contains(x)); cells.RemoveAll(x => PathHelper.GetDistanceBetween(info.disposition.cellId, x) <= MoveCellsCount); if (cells.Count == 0) return; var newCell = cells[random.Next(0, cells.Count())]; var path = new Pathfinder(map, info.disposition.cellId, newCell).FindPath(); if (path != null) { path.Insert(0, info.disposition.cellId); map.Instance.Send(new GameMapMovementMessage(path, info.contextualId)); group.CellId = (ushort)newCell; } else Logger.Error("Unable to move group" + group.MonsterGroupId + " on map " + map.Id + ", wrong path"); }
public void OnBossDeath(MonsterGroup group) { // We have item prefabs if (Game.settings.itemsPrefab.Length > 0) { // Shall we drop ? bool randDrop = Random.Range(0, 10) < Game.settings.ChancesOverTenToGetItem; if (randDrop) { // Which item ? int randItem = Random.Range(0, Game.settings.itemsPrefab.Length); GameObject prefab = Game.settings.itemsPrefab[randItem].gameObject; // Let's drop the item ! Debug.Log("[ITEM DROP]\nName : " + prefab.name); GameObject g = GameObject.Instantiate(prefab) as GameObject; g.transform.position = group.leader.transform.position; g.transform.parent = GameObject.Find("Units/Items").transform; g.transform.name = prefab.name; } } }
public void AddFixedMonsterGroup(AbstractMapInstance instance, MonsterRecord[] monsterRecords, sbyte[] grades, bool quiet) { if (monsterRecords.Length != grades.Length) { throw new Exception("Record array must have same lenght that grade array."); } MonsterGroup group = new MonsterGroup(instance.Record); for (int i = 0; i < monsterRecords.Length; i++) { Monster monster = new Monster(monsterRecords[i], group, grades[i]); group.AddMonster(monster); } if (quiet) { instance.AddQuietEntity(group); } else { instance.AddEntity(group); } }
public static void StartBattle(MonsterGroup monsters) { MainControl.bControl.StartBattle(monsters); MainControl.battle = true; }
public static void EndBattle(MonsterGroup monsters) { MainControl.battle = false; MainControl.dControl.RemoveMonsters(monsters); }
public void SpawnMonsterGroup() { Vector3 min, max; Game.GetMinMaxLevel(out min, out max); int margin = Game.settings.spawnMargin; // Gets a random position within the level area Vector3 pos = new Vector3( Random.Range(min.x + margin, max.x - margin), 0, Random.Range(min.z + margin, max.z - margin) ); if (Game.settings.monsterPrefabs.Length > 0) { Monster boss = this.CreateMonster(null); boss.transform.position = pos; MonsterGroup group = new MonsterGroup(boss); Game.monsterGroups.Add(group); bool isWithClonesIfRacist = (Random.Range(0, 5) == 0); int maxMonsters = Mathf.Max(1, Game.settings.maxMonsterGroupCapacity); if (!boss.Racist || isWithClonesIfRacist) { int minMonsters = 0; if (boss.Weak) { minMonsters = 1; } int nMonsters = Random.Range(minMonsters, maxMonsters); for (int i = 0; i < nMonsters; i++) { Monster monster = this.CreateMonster(boss); group.AddFellow(monster); } } Debug.Log("[MOB SPAWN]\nPosition : " + pos + "\nBoss : " + boss.name + "\nMonsters : " + group.fellows.Count); } else { Debug.LogWarning("We can't spawn any monster (set Game > settings > Monster Prefabs) in " + Game.instance.name); } }
public void OnBossDeath(MonsterGroup e) { previousSpawnTime = Time.time; // Don't spawn now. Game.monsterGroups.Remove(e); }
public void RemoveMonsters(MonsterGroup mg) { foreach (MonsterGroupPos _mg in dungeon.monsters) { if (_mg.mg == mg) { foreach (ActorTile mt in monster_tiles) { if (mt.x == _mg.x && mt.y == _mg.y) { mt.Delete(); monster_tiles.Remove(mt); break; } } dungeon.monsters.Remove(_mg); break; } } }
public static void OnBossDeath(MonsterGroup e) { instance.monsters.OnBossDeath(e); instance.items.OnBossDeath(e); }
public override void OnMobAllocated(Puzzle puzzle, MonsterGroup group) { if (group.Name == "LastMob") group.AddKeyForLock(puzzle.GetPlace("LockedPlace")); }
public override void OnMobAllocated(Puzzle puzzle, MonsterGroup group) { group.AddDrop(Item.CreateKey(70028, 0xEAC014, "lock1")); }