Ejemplo n.º 1
0
        public void HandleLuckForTileDiscovery(Tile _tile)
        {
            List <PawnInstance> monstersOnTile = TileManager.Instance.MonstersOnTile[_tile];
            bool effectApplied = false;

            switch (RollDice())
            {
            case LuckResult.Luck:
                foreach (PawnInstance pi in monstersOnTile)
                {
                    if (pi.GetComponent <Monster>() != null && pi.GetComponent <Monster>().GetMType == MonsterType.Common)
                    {
                        pi.GetComponent <Mortal>().CurrentHp = 0;
                        effectApplied = true;
                        break;
                    }
                }
                if (!effectApplied)
                {
                    sucessiveLuck--;
                }
                break;

            case LuckResult.BadLuck:
                if (monstersOnTile.Count < 3)
                {
                    PrefabUtils pus = GameManager.Instance.PrefabUtils;
                    GameObject  monsterToPopPrefab = pus.getMonsterPrefabById("wolf");
                    if (_tile.Type == TileType.Beach)
                    {
                        monsterToPopPrefab = pus.getMonsterPrefabById("snake");
                    }
                    else if (_tile.Type == TileType.Plain)
                    {
                        monsterToPopPrefab = pus.getMonsterPrefabById("jacob");
                    }
                    else if (_tile.Type == TileType.Snow)
                    {
                        monsterToPopPrefab = pus.getMonsterPrefabById("snowwolf");
                    }
                    else if (_tile.Type == TileType.Forest)
                    {
                        monsterToPopPrefab = pus.getMonsterPrefabById("bird");
                    }
                    else if (_tile.Type == TileType.Desert)
                    {
                        monsterToPopPrefab = pus.getMonsterPrefabById("wolf");
                    }
                    else if (_tile.Type == TileType.China)
                    {
                        monsterToPopPrefab = pus.listMonstersPrefab[Random.Range(0, pus.listMonstersPrefab.Count)].prefabPawn;
                    }

                    Instantiate(monsterToPopPrefab,
                                GameManager.Instance.GetFirstSelectedKeeper().CurrentTile.transform.position,
                                Quaternion.identity, GameManager.Instance.GetFirstSelectedKeeper().CurrentTile.transform);
                    effectApplied = true;
                }
                if (!effectApplied)
                {
                    sucessiveBadLuck--;
                }
                break;

            default:
                break;
            }
        }