예제 #1
0
    // Use this for initialization
    void Start()
    {
        ok.SetActive(false);
        wc   = GetComponent <WarnController> ();
        bait = GetComponent <Bait> ();
        Para p = GameController.db.getPara(GameController.curLevel);

        bait.setLevel(p);
        isBaiting = false;
        isFishing = false;
        isSuccess = false;
        for (int i = 0; i < numFish; i++)
        {
            Vector3 pos = new Vector3(Random.Range(xMin, xMax),
                                      Random.Range(yMin, yMax),
                                      Random.Range(zMin, zMax));
            allFish [i] = (GameObject)Instantiate(fishPrefab, pos, Quaternion.identity);
            flock_Creek f = allFish [i].GetComponent <flock_Creek> ();
            f.id = i;
            float scale = Random.Range(0.2f, 0.6f);
            allFish [i].transform.localScale = new Vector3(scale, scale, scale);
            f.scale = scale;
        }
        goalPos = goalPrefab.transform.position;
        m_timer = 0;
        //Debug.Log ("goalPos: (" + goalPos.x + ", " + goalPos.y + ", " + goalPos.z + ")!");

        /*GameController.db = new DataAccess ();
         * GameController.curLevel = GameController.db.getUserLevel (GameController.username);
         * GameController.curScore = GameController.db.getUserScore (GameController.username);
         * GameController.curNumFish = 0;*/
    }
예제 #2
0
 public void spawnNewSpiderFromBait(string spiderSpawnerName, SpiderSpawner spiderSpawnerScript)
 {
     if (spiderSpawnerScript.mySpider == null && spiderSpawnerScript.myBait != null)
     {
         Bait       baitScript           = spiderSpawnerScript.myBait.GetComponent <Bait>();
         int        min                  = baitScript.spiderMin;
         int        max                  = baitScript.spiderMax;
         GameObject selectedSpiderPrefab = spiderPrefabs[UnityEngine.Random.Range(min, max)];
         if ((PlayerPrefs.GetInt("totalSpidersKilled") == 0 && PlayerPrefs.GetInt("uniqueSpiderVisits") >= 24 && PlayerPrefs.GetInt("anansiHasVisited") == 0) ||
             (PlayerPrefs.GetInt("anansiHasVisited") == 1 && UnityEngine.Random.Range(0, 25) == 0))
         {
             PlayerPrefs.SetInt("anansiHasVisited", 1);
             selectedSpiderPrefab = spiderPrefabDictionary["Anansi"];
         }
         if (availableSpiders[selectedSpiderPrefab.name] && specialSpiderConditions(selectedSpiderPrefab.name))
         {
             int newNumberOfVisits = PlayerPrefs.GetInt(selectedSpiderPrefab.name + ".numberOfVisits") + 1;
             PlayerPrefs.SetInt(selectedSpiderPrefab.name + ".numberOfVisits", newNumberOfVisits);
             if (newNumberOfVisits >= 3)
             {
                 maybeKillSpider(selectedSpiderPrefab.name);
             }
             spiderSpawnerScript.SendMessage("cleanUpSpider");
             availableSpiders[selectedSpiderPrefab.name] = false;
             spiderSpawnerScript.spiderPrefab            = selectedSpiderPrefab;
             spiderSpawnerScript.SendMessage("spawnSpider");
         }
     }
 }
예제 #3
0
    // Use this for initialization
    void Start()
    {
        m_BGMScrollbar.value   = SoundManager.Instance.BGMVolume;
        m_soundScrollbar.value = SoundManager.Instance.SoundVolume;

        m_transform             = this.transform;
        m_rodTransform.rotation = m_transform.rotation;

        m_rodTransform.Translate(10000, 10000, 10000);
        m_rod.SetActive(false);

        _playerState = this.GetComponentInChildren <PlayerState>();
        _playerState.PlayerModeChanged += ChangePlayerState;

        GameObject[] _blocksObject;
        _blocksObject = GameObject.FindGameObjectsWithTag("Block");
        _blocks       = new Block[_blocksObject.Length];
        for (int i = 0; i < _blocksObject.Length; i++)
        {
            _blocks [i] = _blocksObject [i].GetComponent <Block> ();
            _blocks [i].HookProbabilityChanged += ChangeHookProbability;
        }

        _bait = m_bait.GetComponent <Bait> ();
        _bait.BaitTouchedWater += BaitTouchWater;
        _bait.BaitTouchedWater += NotifyHookProbabilityChanged;

        _lastDistance = XBikeEventReceiver.Data.Distance;
    }
예제 #4
0
    // Use this for initialization
    void Start()
    {
        ok.SetActive(false);
        wc   = GetComponent <WarnController> ();
        bait = GetComponent <Bait> ();
        Para p = GameController.db.getPara(GameController.curLevel);

        bait.setLevel(p);
        isBaiting = false;
        isFishing = false;
        isSuccess = false;
        for (int i = 0; i < numFish; i++)
        {
            Vector3 pos = new Vector3(Random.Range(xMin, xMax),
                                      Random.Range(yMin, yMax),
                                      Random.Range(zMin, zMax));
            allFish [i] = (GameObject)Instantiate(fishPrefab, pos, Quaternion.identity);
            flock_Island f = allFish [i].GetComponent <flock_Island> ();
            f.id = i;
            float scale = Random.Range(0.4f, 0.6f);
            allFish [i].transform.localScale = new Vector3(scale, scale, scale);
            f.scale = scale;
        }
        goalPos = goalPrefab.transform.position;
        m_timer = 0;
    }
예제 #5
0
        public ActionResult CreateBait(Bait model, List <string> Fishes)
        {
            if (model.Id != 0 && IsAdmin)
            {
                var bait = db.Baits.First(x => x.Id == model.Id);
                bait.Name        = model.Name;
                bait.Description = model.Description;
                bait.Image       = model.Image;

                if (Fishes != null)
                {
                    bait.Fishes.RemoveAll(x => x.Id != -1);
                    Fishes?.ForEach(x => bait.Fishes.Add(db.Fishes.First(y => y.Name == x)));
                }

                db.SaveChanges();
            }
            else if (db.Baits.FirstOrDefault(x => x.Name == model.Name) == null)
            {
                Fishes?.ForEach(x => model.Fishes.Add(db.Fishes.First(y => y.Name == x)));
                db.Baits.Add(model);
                db.SaveChanges();
                return(RedirectToAction($"AdminPanel"));
            }
            return(RedirectToAction($"Bait/{model.Id}"));
        }
예제 #6
0
파일: Fish.cs 프로젝트: kugimasa/Fishy
 void Start()
 {
     isGrounded = false;
     canEatBait = false;
     bait       = baitObject.GetComponent <Bait>();
     animator   = GetComponent <Animator>();
     fishBone   = transform.GetChild(0).gameObject.transform;
 }
예제 #7
0
파일: DefCooking.cs 프로젝트: ygtkms/ServUO
        private Item CraftCharydbisBait(Mobile m, CraftItem craftItem, ITool tool)
        {
            var bait = new Bait();

            bait.Index         = 35;
            bait.UsesRemaining = 5;

            return(bait);
        }
예제 #8
0
    public void StartBuff(Bait buff)
    {
        SingleBaitData data = new SingleBaitData();

        data.BaitId        = buff.ID;
        data.BuffEndTime   = RandomUtils.GetTime() + buff.Duration;
        data.NextSpawnTime = RandomUtils.GetTime() + buff.MinDropTime;
        SaveData.Add(data);
    }
예제 #9
0
파일: Fish.cs 프로젝트: wencong/FirstTest
    public bool IsEatBait(Bait bait)
    {
        int nNeedLevel = baitList[(int)bait.type];

        if (nNeedLevel <= bait.level && nNeedLevel != -1)
        {
            return(true);
        }
        return(false);
    }
예제 #10
0
파일: Bait.cs 프로젝트: Grivik/Zelda_VR
    }                                                         // Only one Bait is allowed at a time.


    void Start()
    {
        ActiveBait = this;

        DungeonRoom dr;

        if (IsHungryGoriyaNpcPresent(out dr))
        {
            FeedGoriya(dr);
        }
    }
예제 #11
0
 /// <summary>
 /// Get a list of possible fish to get depending on the conditions
 /// </summary>
 /// <param name="isRaining">true if it's raining</param>
 /// <param name="hour">hour of the game</param>
 /// <param name="bait">bait used, can be null</param>
 /// <param name="list">lsit to be filled, need to be init but not cleared</param>
 public void GetPossibleFish(bool isRaining, int hour, Bait bait, BonusBait bonusBait, List <Fish> list)
 {
     list.Clear();
     foreach (Fish fish in _fish)
     {
         if (fish.CanBeFished(isRaining, bait, bonusBait, hour))
         {
             list.Add(fish);
         }
     }
 }
예제 #12
0
 private bool IsGoodBait(Bait bait)
 {
     if (_needBait)
     {
         return(bait != null && (_workingBait.Count == 0 || _workingBait.Exists((Bait b) => { return b.ID == bait.ID; })));
     }
     else
     {
         return(true);
     }
 }
예제 #13
0
        public void AddBait(Bait bait)
        {
            MessageBox.Show(bait.Count.ToString());
            var b = BaitInv.FirstOrDefault(fb => bait.Name.Equals(fb.Name));

            if (b != default)
            {
                BaitInv[BaitInv.IndexOf(b)].Count += bait.Count;
            }
            else
            {
                BaitInv.Add(bait);
            }
        }
예제 #14
0
        /// <inheritdoc/>
        protected override void LoadContentPack(IContentPack contentPack)
        {
            // categories
            if (contentPack.TryLoadAsset <List <FishCategory> >("categories.json", out var fishCategories))
            {
                Categories.StageItems(fishCategories);
            }

            // location areas
            if (contentPack.TryLoadAsset <List <LocationArea> >("locations.json", out var locations))
            {
                LocationAreas.StageItems(locations);
            }

            // bait
            if (contentPack.TryLoadAsset <List <Bait> >("bait.json", out var bait))
            {
                Bait.StageItems(bait);
            }
        }
    private IEnumerator Fishing(bool isRainig, int hour, Bait bait, BonusBait bonusBait)
    {
        _beginEvent.Invoke();
        _fishing = true;
        _fishDatabase.GetPossibleFish(isRainig, hour, bait, bonusBait, _fishList);
        Debug.Assert(_fishList.Count != 0);
        yield return(0); //wait next frame

        _fish = RandomFish(bonusBait);
        float wait = _fish.GetWaitSecond();

        yield return(new WaitForSecondsRealtime(wait - (bonusBait != null?wait * bonusBait.BonusPercentWaitTime:0)));

        _hooking = true;
        _hookEvent.Invoke(_fish.Rarity);
        yield return(new WaitForSecondsRealtime(_fish.HookSecond));

        _failEvent.Invoke();
        _fish = null; _hooking = false; _fishing = false;
    }
예제 #16
0
    public FollowerData GetDrop(Bait bait)
    {
        int total = bait.DropChances.Sum(d => d.Chance);

        if (total == 0)
        {
            return(null);
        }

        int roll = Random.Range(1, total + 1);

        foreach (var drop in bait.DropChances)
        {
            roll -= drop.Chance;
            if (roll <= 0)
            {
                return(drop.Data);
            }
        }

        return(null);
    }
예제 #17
0
파일: Enemy.cs 프로젝트: mBeierl/GGJ16
	void Wander ()
	{
		currChasedBait = null;
		myPathfinder.speed = NormalSpeed;
		myPathfinder.NewFleeTarget(transform, myPathCallback, Random.Range(10, 80));
        CurrrentState = EnemyState.MovingAround;
	}
예제 #18
0
 /// <summary>
 /// Test if a fish can be fished depending of the conditions
 /// </summary>
 /// <param name="isRaining">true if it's raining</param>
 /// <param name="bait">bait used, can be null</param>
 /// <param name="hour">hour of the game</param>
 /// <returns>true if the fish can be fished</returns>
 public bool CanBeFished(bool isRaining, Bait bait, BonusBait bonusBait, int hour)
 {
     return(((bonusBait != null && bonusBait.BonusIgnoreHour) || IsGoodHour(hour)) && ((bonusBait != null && bonusBait.BonusIgnoreWeaher) || IsGoodWeather(isRaining)) && IsGoodBait(bait));
 }
예제 #19
0
 void Start()
 {
     fish = fishObject.GetComponent <Fish>();
     bait = baitObject.GetComponent <Bait>();
 }
예제 #20
0
        // Load the monster.txt drop file.
        private void LoadDropFile(bool edit)
        {
            var lines = (edit == false) ? File.ReadAllLines(Path.Combine(Settings.DropPath, String.Format("{0}.txt", listBoxMonsters.SelectedItem)), Encoding.GetEncoding("euc-kr")) : textBoxDropList.Lines;

            for (int i = 0; i < lines.Length; i++)
            {
                if (lines[i].StartsWith(";Gold"))
                {
                    if (lines[i + 1].StartsWith("1/"))
                    {
                        var workingLine = lines[i + 1].Split(' ');
                        GoldOdds = workingLine[0].Remove(0, 2);
                        Gold     = workingLine[2];
                        break;
                    }
                    else
                    {
                        GoldOdds = "0";
                        Gold     = "0";
                    }
                }
            }

            string[] Headers = new string[34]
            {
                ";Weapons",
                ";Armours",
                ";Helmets",
                ";Necklaces",
                ";Bracelets",
                ";Rings",
                ";Amulets",
                ";Belts",
                ";Boots",
                ";Stones",
                ";Torches",
                ";Potions",
                ";Ores",
                ";Meat",
                ";Crafting Materials",
                ";Scrolls",
                ";Gems",
                ";Mount",
                ";Books",
                ";Nothing",
                ";Script",
                ";Reins",
                ";Bells",
                ";Saddle",
                ";Ribbon",
                ";Mask",
                ";Food",
                ";Hook",
                ";Float",
                ";Bait",
                ";Finder",
                ";Reel",
                ";Fish",
                ";Quest"
            };

            for (int i = 0; i < Headers.Length; i++)
            {
                for (int j = 0; j < lines.Length; j++)
                {
                    if (lines[j].StartsWith(Headers[i]))
                    {
                        for (int k = j + 1; k < lines.Length; k++)
                        {
                            if (lines[k].StartsWith(";"))
                            {
                                break;
                            }

                            var workingLine = lines[k].Split(' ');
                            if (workingLine.Length < 2)
                            {
                                continue;
                            }

                            var quest = "";

                            if (workingLine.Length > 2 && workingLine[2] == "Q")
                            {
                                quest = workingLine[2];
                            }

                            DropItem newDropItem = new DropItem {
                                Odds = workingLine[0], Name = workingLine[1], Quest = quest
                            };
                            switch (i)
                            {
                            case 0:
                                Weapon.Add(newDropItem);
                                break;

                            case 1:
                                Armour.Add(newDropItem);
                                break;

                            case 2:
                                Helmet.Add(newDropItem);
                                break;

                            case 3:
                                Necklace.Add(newDropItem);
                                break;

                            case 4:
                                Bracelet.Add(newDropItem);
                                break;

                            case 5:
                                Ring.Add(newDropItem);
                                break;

                            case 6:
                                Amulet.Add(newDropItem);
                                break;

                            case 7:
                                Belt.Add(newDropItem);
                                break;

                            case 8:
                                Boot.Add(newDropItem);
                                break;

                            case 9:
                                Stone.Add(newDropItem);
                                break;

                            case 10:
                                Torch.Add(newDropItem);
                                break;

                            case 11:
                                Potion.Add(newDropItem);
                                break;

                            case 12:
                                Ore.Add(newDropItem);
                                break;

                            case 13:
                                Meat.Add(newDropItem);
                                break;

                            case 14:
                                CraftingMaterial.Add(newDropItem);
                                break;

                            case 15:
                                Scrolls.Add(newDropItem);
                                break;

                            case 16:
                                Gem.Add(newDropItem);
                                break;

                            case 17:
                                Mount.Add(newDropItem);
                                break;

                            case 18:
                                Book.Add(newDropItem);
                                break;

                            case 19:
                                Nothing.Add(newDropItem);
                                break;

                            case 20:
                                Script.Add(newDropItem);
                                break;

                            case 21:
                                Reins.Add(newDropItem);
                                break;

                            case 22:
                                Bells.Add(newDropItem);
                                break;

                            case 23:
                                Saddle.Add(newDropItem);
                                break;

                            case 24:
                                Ribbon.Add(newDropItem);
                                break;

                            case 25:
                                Mask.Add(newDropItem);
                                break;

                            case 26:
                                Food.Add(newDropItem);
                                break;

                            case 27:
                                Hook.Add(newDropItem);
                                break;

                            case 28:
                                Float.Add(newDropItem);
                                break;

                            case 29:
                                Bait.Add(newDropItem);
                                break;

                            case 30:
                                Finder.Add(newDropItem);
                                break;

                            case 31:
                                Reel.Add(newDropItem);
                                break;

                            case 32:
                                Fish.Add(newDropItem);
                                break;

                            case 33:
                                Quest.Add(newDropItem);
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }
        }
예제 #21
0
        // Add the item to the drop list
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            int dropChance;

            int.TryParse(textBoxItemOdds.Text, out dropChance);

            if (dropChance < 1)
            {
                dropChance = 1;
            }

            string quest = QuestOnlyCheckBox.Checked ? "Q" : "";

            try
            {
                switch (tabControlSeperateItems.SelectedTab.Tag.ToString())
                {
                case "Weapon":
                    Weapon.Add(new DropItem {
                        Name = listBoxWeapon.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Armour":
                    Armour.Add(new DropItem {
                        Name = listBoxArmour.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Helmet":
                    Helmet.Add(new DropItem {
                        Name = listBoxHelmet.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Necklace":
                    Necklace.Add(new DropItem {
                        Name = listBoxNecklace.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Bracelet":
                    Bracelet.Add(new DropItem {
                        Name = listBoxBracelet.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Ring":
                    Ring.Add(new DropItem {
                        Name = listBoxRing.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Amulet":
                    Amulet.Add(new DropItem {
                        Name = listBoxAmulet.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Belt":
                    Belt.Add(new DropItem {
                        Name = listBoxBelt.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Boots":
                    Boot.Add(new DropItem {
                        Name = listBoxBoot.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Stone":
                    Stone.Add(new DropItem {
                        Name = listBoxStone.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Torch":
                    Torch.Add(new DropItem {
                        Name = listBoxTorch.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Potion":
                    Potion.Add(new DropItem {
                        Name = listBoxPotion.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Ore":
                    Ore.Add(new DropItem {
                        Name = listBoxOre.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Meat":
                    Meat.Add(new DropItem {
                        Name = listBoxMeat.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "CraftingMaterial":
                    CraftingMaterial.Add(new DropItem {
                        Name = listBoxCraftingMaterial.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance)
                    });
                    break;

                case "Scroll":
                    Scrolls.Add(new DropItem {
                        Name = listBoxScroll.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Gem":
                    Gem.Add(new DropItem {
                        Name = listBoxGem.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Mount":
                    Mount.Add(new DropItem {
                        Name = listBoxMount.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Book":
                    Book.Add(new DropItem {
                        Name = listBoxBook.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Nothing":
                    Nothing.Add(new DropItem {
                        Name = listBoxNothing.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Script":
                    Script.Add(new DropItem {
                        Name = listBoxScript.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Reins":
                    Reins.Add(new DropItem {
                        Name = listBoxReins.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Bells":
                    Bells.Add(new DropItem {
                        Name = listBoxBells.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Saddle":
                    Saddle.Add(new DropItem {
                        Name = listBoxSaddle.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Ribbon":
                    Ribbon.Add(new DropItem {
                        Name = listBoxRibbon.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Mask":
                    Mask.Add(new DropItem {
                        Name = listBoxMask.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Food":
                    Food.Add(new DropItem {
                        Name = listBoxFood.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", dropChance), Quest = quest
                    });
                    break;

                case "Hook":
                    Hook.Add(new DropItem {
                        Name = listBoxHook.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Float":
                    Float.Add(new DropItem {
                        Name = listBoxFloat.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Bait":
                    Bait.Add(new DropItem {
                        Name = listBoxBait.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Finder":
                    Finder.Add(new DropItem {
                        Name = listBoxFinder.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Reel":
                    Reel.Add(new DropItem {
                        Name = listBoxReel.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Fish":
                    Fish.Add(new DropItem {
                        Name = listBoxFish.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;

                case "Quest":
                    Quest.Add(new DropItem {
                        Name = listBoxQuest.SelectedItem.ToString().Replace(" ", string.Empty), Odds = string.Format("1/{0}", textBoxItemOdds.Text), Quest = quest
                    });
                    break;
                }

                UpdateDropFile();
            }
            catch
            {
                //No item selected when trying to add an item to the drop
            }
        }
예제 #22
0
파일: Bait.cs 프로젝트: Grivik/Zelda_VR
 void OnDestroy()
 {
     ActiveBait = null;
 }
예제 #23
0
 /// <inheritdoc/>
 protected override void InitialiseContentPackLoading()
 {
     Categories.Clear();
     LocationAreas.Clear();
     Bait.Clear();
 }
예제 #24
0
 /// <inheritdoc/>
 protected override void FinaliseContentPackLoading()
 {
     Categories.ProcessStagedItems();
     LocationAreas.ProcessStagedItems();
     Bait.ProcessStagedItems();
 }
예제 #25
0
파일: Enemy.cs 프로젝트: mBeierl/GGJ16
	public void Eat (Bait bait)
	{
		// despawn will also notify other cats to stop chasing this bait (avoids rare bug of having another bait spawned with the just released pooled bait object,
		// and messing up the test of whether or not the bait is active and detectable to continue chasing it, allowing cats to chase the recycled bait at the other side of the map)
		// another solution is to wait at least one frame before recycling a pooled object to make sure all connections are canceled during the next FSM update transitions

		// new version: start eating
		bait.OnEat(this);
	}
예제 #26
0
파일: Enemy.cs 프로젝트: mBeierl/GGJ16
	void ChaseBait (Bait bait) {
		// seek bait
		currChasedBait = bait;
		bait.RegisterChasingCat(this);

		myPathfinder.speed = FollowSpeed;
		myPathfinder.NewTarget(bait.transform, myPathCallback, -1, true);
		CurrrentState = EnemyState.ChasingBait;
	}
예제 #27
0
        public static double GetPoints(Item item)
        {
            double points = 0;

            Type type = item.GetType();

            if (Entries.ContainsKey(type))
            {
                points = Entries[type];

                if (item.Stackable)
                {
                    points = points * item.Amount;
                }

                return(points);
            }
            else
            {
                if (item is RunicHammer)
                {
                    RunicHammer hammer = (RunicHammer)item;

                    if (hammer.Resource == CraftResource.DullCopper)
                    {
                        points = 5 * hammer.UsesRemaining;
                    }
                    else if (hammer.Resource == CraftResource.ShadowIron)
                    {
                        points = 10 * hammer.UsesRemaining;
                    }
                    else if (hammer.Resource == CraftResource.Copper)
                    {
                        points = 25 * hammer.UsesRemaining;
                    }
                    else if (hammer.Resource == CraftResource.Bronze)
                    {
                        points = 100 * hammer.UsesRemaining;
                    }
                    else if (hammer.Resource == CraftResource.Gold)
                    {
                        points = 250 * hammer.UsesRemaining;
                    }
                    else if (hammer.Resource == CraftResource.Agapite)
                    {
                        points = 1000 * hammer.UsesRemaining;
                    }
                    else if (hammer.Resource == CraftResource.Verite)
                    {
                        points = 4000 * hammer.UsesRemaining;
                    }
                    else if (hammer.Resource == CraftResource.Valorite)
                    {
                        points = 8000 * hammer.UsesRemaining;
                    }
                }
                else if (item is RunicSewingKit)
                {
                    RunicSewingKit sewing = (RunicSewingKit)item;

                    if (sewing.Resource == CraftResource.SpinedLeather)
                    {
                        points = 10 * sewing.UsesRemaining;
                    }
                    else if (sewing.Resource == CraftResource.HornedLeather)
                    {
                        points = 100 * sewing.UsesRemaining;
                    }
                    else if (sewing.Resource == CraftResource.BarbedLeather)
                    {
                        points = 400 * sewing.UsesRemaining;
                    }
                }
                else if (item is PowerScroll)
                {
                    PowerScroll ps = (PowerScroll)item;

                    if (ps.Value == 105)
                    {
                        points = 50;
                    }
                    else if (ps.Value == 110)
                    {
                        points = 100;
                    }
                    else if (ps.Value == 115)
                    {
                        points = 500;
                    }
                    else if (ps.Value == 120)
                    {
                        points = 2500;
                    }
                }
                else if (item is ScrollofTranscendence)
                {
                    SpecialScroll sot = (SpecialScroll)item;

                    points = sot.Value / 0.1 * 2;
                }
                else if (item is Bait)
                {
                    Bait bait = (Bait)item;

                    points = 10 * bait.UsesRemaining;
                }
                else if (item is TreasureMap)
                {
                    TreasureMap tmap = (TreasureMap)item;

                    if (tmap.Level == 1)
                    {
                        points = 50;
                    }
                    else if (tmap.Level == 2)
                    {
                        points = 100;
                    }
                    else if (tmap.Level == 3)
                    {
                        points = 250;
                    }
                    else if (tmap.Level == 4)
                    {
                        points = 500;
                    }
                    else if (tmap.Level == 5)
                    {
                        points = 750;
                    }
                    else if (tmap.Level == 6)
                    {
                        points = 1000;
                    }
                }
                else if (item is MidnightBracers && item.LootType == LootType.Cursed)
                {
                    points = 5000;
                }
                else if (item is MonsterStatuette)
                {
                    MonsterStatuette ms = (MonsterStatuette)item;

                    if (ms.Type == MonsterStatuetteType.Slime)
                    {
                        points = 5000;
                    }
                }
                else if (item is PigmentsOfTokuno || item is LesserPigmentsOfTokuno)
                {
                    BasePigmentsOfTokuno pigments = (BasePigmentsOfTokuno)item;
                    points = 500 * pigments.UsesRemaining;
                }

                return(points);
            }
        }
예제 #28
0
        public static double GetPoints(Item item)
        {
            if (item is IVvVItem && ((IVvVItem)item).IsVvVItem)
            {
                return(0);
            }

            double points = 0;

            Type type = item.GetType();

            if (Entries.ContainsKey(type))
            {
                points = Entries[type];

                // Kind of ametuar, but if this arrizes more, we'll make a seperate function
                if (item is SOS && ((SOS)item).IsAncient)
                {
                    points = 2500;
                }

                if (item.Stackable)
                {
                    points = points * item.Amount;
                }

                return(points);
            }
            else
            {
                if (item is RunicHammer)
                {
                    RunicHammer hammer = (RunicHammer)item;

                    if (hammer.Resource == CraftResource.DullCopper)
                    {
                        points = 5 * hammer.UsesRemaining;
                    }
                    else if (hammer.Resource == CraftResource.ShadowIron)
                    {
                        points = 10 * hammer.UsesRemaining;
                    }
                    else if (hammer.Resource == CraftResource.Copper)
                    {
                        points = 25 * hammer.UsesRemaining;
                    }
                    else if (hammer.Resource == CraftResource.Bronze)
                    {
                        points = 100 * hammer.UsesRemaining;
                    }
                    else if (hammer.Resource == CraftResource.Gold)
                    {
                        points = 250 * hammer.UsesRemaining;
                    }
                    else if (hammer.Resource == CraftResource.Agapite)
                    {
                        points = 1000 * hammer.UsesRemaining;
                    }
                    else if (hammer.Resource == CraftResource.Verite)
                    {
                        points = 4000 * hammer.UsesRemaining;
                    }
                    else if (hammer.Resource == CraftResource.Valorite)
                    {
                        points = 8000 * hammer.UsesRemaining;
                    }
                }
                else if (item is RunicSewingKit)
                {
                    RunicSewingKit sewing = (RunicSewingKit)item;

                    if (sewing.Resource == CraftResource.SpinedLeather)
                    {
                        points = 10 * sewing.UsesRemaining;
                    }
                    else if (sewing.Resource == CraftResource.HornedLeather)
                    {
                        points = 100 * sewing.UsesRemaining;
                    }
                    else if (sewing.Resource == CraftResource.BarbedLeather)
                    {
                        points = 400 * sewing.UsesRemaining;
                    }
                }
                else if (item is PowerScroll)
                {
                    PowerScroll ps = (PowerScroll)item;

                    if (ps.Value == 105)
                    {
                        points = 50;
                    }
                    else if (ps.Value == 110)
                    {
                        points = 100;
                    }
                    else if (ps.Value == 115)
                    {
                        points = 500;
                    }
                    else if (ps.Value == 120)
                    {
                        points = 2500;
                    }
                }
                else if (item is ScrollOfTranscendence)
                {
                    SpecialScroll sot = (SpecialScroll)item;

                    points = sot.Value / 0.1 * 2;
                }
                else if (item is Bait)
                {
                    Bait bait = (Bait)item;

                    points = 10 * bait.UsesRemaining;
                }
                else if (item is TreasureMap)
                {
                    TreasureMap tmap = (TreasureMap)item;

                    if (tmap.Level == 1)
                    {
                        points = 50;
                    }
                    else if (tmap.Level == 2)
                    {
                        points = 100;
                    }
                    else if (tmap.Level == 3)
                    {
                        points = 250;
                    }
                    else if (tmap.Level == 4)
                    {
                        points = 500;
                    }
                    else if (tmap.Level == 5)
                    {
                        points = 750;
                    }
                    else if (tmap.Level == 6)
                    {
                        points = 1000;
                    }
                }
                else if (item is MidnightBracers && item.LootType == LootType.Cursed)
                {
                    points = 5000;
                }
                else if (item is MonsterStatuette)
                {
                    MonsterStatuette ms = (MonsterStatuette)item;

                    if (ms.Type == MonsterStatuetteType.Slime)
                    {
                        points = 5000;
                    }
                }
                else if (item is PigmentsOfTokuno || item is LesserPigmentsOfTokuno)
                {
                    BasePigmentsOfTokuno pigments = (BasePigmentsOfTokuno)item;
                    points = 500 * pigments.UsesRemaining;
                }
                else if (item is ICombatEquipment)
                {
                    points = GetPointsForEquipment(item);
                }

                if (item.LootType != LootType.Blessed && points < 100 && item is IShipwreckedItem && ((IShipwreckedItem)item).IsShipwreckedItem)
                {
                    points = 100;
                }

                return(points);
            }
        }
예제 #29
0
파일: Enemy.cs 프로젝트: mBeierl/GGJ16
	void ChasePlayer () {
		currChasedBait = null;
		myPathfinder.speed = FollowSpeed;
		myPathfinder.NewTarget(GameManager.current.Player.transform, myPathCallback, -1, true);
		CurrrentState = EnemyState.ChasingPlayer;

	}
예제 #30
0
        public static void GiveRewards(Mobile from, PlayerFishingEntry entry, double points)
        {
            Container pack = from.Backpack;

            if (pack == null)
            {
                pack = from.BankBox;
            }

            int tier     = 1;
            int category = 1;

            double roll = Utility.RandomDouble();

            if (points >= 100)
            {
                tier = 2;
            }
            else if (points >= 150)
            {
                tier = 3;
            }
            else if (points >= 210)
            {
                tier = 4;
            }

            if (roll < .10)
            {
                category = 4;
            }
            else if (roll < .25)
            {
                category = 3;
            }
            else if (roll < .50)
            {
                category = 2;
            }

            Type type = m_RewardTable[tier - 1][category - 1][Utility.Random(m_RewardTable[tier - 1][category - 1].Length)];

            Item item = Loot.Construct(type);

            if (item != null)
            {
                if (item is PowerScroll)
                {
                    int    value;
                    double chance = Utility.RandomDouble();

                    switch (tier)
                    {
                    default:
                    case 1:
                        if (0.01 > chance)
                        {
                            value = 120;
                        }
                        else if (0.05 > chance)
                        {
                            value = 115;
                        }
                        else if (chance > 0.25)
                        {
                            value = 110;
                        }
                        else
                        {
                            value = 105;
                        }
                        break;

                    case 2:
                        if (0.05 > chance)
                        {
                            value = 120;
                        }
                        else if (0.25 > chance)
                        {
                            value = 115;
                        }
                        else
                        {
                            value = 110;
                        }
                        break;

                    case 3:
                        if (0.10 > chance)
                        {
                            value = 120;
                        }
                        else
                        {
                            value = 115;
                        }
                        break;

                    case 4:
                        value = 120;
                        break;
                    }

                    ((PowerScroll)item).Skill = SkillName.Fishing;
                    ((PowerScroll)item).Value = value;
                    from.SendLocalizedMessage(1149591); //
                }
                else if (item is BaseBook)
                {
                    from.SendLocalizedMessage(1149590); //You receive a rare book.
                }
                else if (item is Bait)
                {
                    Bait bait = (Bait)item;

                    switch (tier)
                    {
                    case 1:
                        bait.Index = Utility.Random(15);
                        if (0.001 >= Utility.RandomDouble())
                        {
                            bait.Enhanced = true;
                        }
                        break;

                    case 2:
                        bait.Index = Utility.Random(34);
                        if (0.005 >= Utility.RandomDouble())
                        {
                            bait.Enhanced = true;
                        }
                        break;

                    case 3:
                        bait.Index = Utility.Random(34);
                        if (0.01 >= Utility.RandomDouble())
                        {
                            bait.Enhanced = true;
                        }
                        break;

                    case 4:
                        if (Utility.RandomBool())
                        {
                            bait.Index = 35;
                        }
                        else
                        {
                            bait.Index = Utility.RandomMinMax(16, 34);
                        }
                        if (0.05 >= Utility.RandomDouble())
                        {
                            bait.Enhanced = true;
                        }
                        break;
                    }

                    if (FishInfo.GetTypeFromIndex(bait.Index) == typeof(Charydbis))
                    {
                        bait.UsesRemaining = 5;
                        from.SendLocalizedMessage(1150871); //You receive charybdis bait

                        if (0.08 >= Utility.RandomDouble())
                        {
                            bait.Enhanced = true;
                        }
                    }
                    else
                    {
                        object label = FishInfo.GetFishLabel(bait.Index);

                        if (label is int)
                        {
                            from.SendLocalizedMessage(1149588, string.Format("#{0}\t", (int)label)); //You receive bait to catch ~1_val~
                        }
                        else
                        {
                            from.SendLocalizedMessage(1149588, (string)label);      //You receive bait to catch ~1_val~
                        }
                        bait.UsesRemaining = (int)Math.Min(200, points / 2);
                    }
                }
                else if (item is PermanentBoatPaint)
                {
                    from.SendMessage("You recieve permanent boat paint!");
                }
                else
                {
                    if (item is FishingPole)
                    {
                        BaseRunicTool.ApplyAttributesTo((FishingPole)item, false, 0, Utility.RandomMinMax(1, tier + 1), 25, 100);
                    }

                    from.SendLocalizedMessage(1149589); //You receive some rare fishing equipment.
                }

                pack.DropItem(item);

                if (entry != null)
                {
                    entry.OnAfterReward(points);
                }
            }
        }
예제 #31
0
        public static void eraseAllRoles(this PlayerControl player)
        {
            foreach (var t in RoleData.allRoleTypes)
            {
                t.Value.GetMethod("eraseRole", BindingFlags.Public | BindingFlags.Static)?.Invoke(null, new object[] { player });
            }

            // Crewmate roles
            if (player.isRole(RoleType.Mayor))
            {
                Mayor.clearAndReload();
            }
            if (player.isRole(RoleType.Engineer))
            {
                Engineer.clearAndReload();
            }
            if (player.isRole(RoleType.Detective))
            {
                Detective.clearAndReload();
            }
            if (player.isRole(RoleType.TimeMaster))
            {
                TimeMaster.clearAndReload();
            }
            if (player.isRole(RoleType.Medic))
            {
                Medic.clearAndReload();
            }
            if (player.isRole(RoleType.Shifter))
            {
                Shifter.clearAndReload();
            }
            if (player.isRole(RoleType.Seer))
            {
                Seer.clearAndReload();
            }
            if (player.isRole(RoleType.Hacker))
            {
                Hacker.clearAndReload();
            }
            if (player.isRole(RoleType.Tracker))
            {
                Tracker.clearAndReload();
            }
            if (player.isRole(RoleType.Snitch))
            {
                Snitch.clearAndReload();
            }
            if (player.isRole(RoleType.Swapper))
            {
                Swapper.clearAndReload();
            }
            if (player.isRole(RoleType.Spy))
            {
                Spy.clearAndReload();
            }
            if (player.isRole(RoleType.SecurityGuard))
            {
                SecurityGuard.clearAndReload();
            }
            if (player.isRole(RoleType.Bait))
            {
                Bait.clearAndReload();
            }
            if (player.isRole(RoleType.Medium))
            {
                Medium.clearAndReload();
            }

            // Impostor roles
            if (player.isRole(RoleType.Morphling))
            {
                Morphling.clearAndReload();
            }
            if (player.isRole(RoleType.Camouflager))
            {
                Camouflager.clearAndReload();
            }
            if (player.isRole(RoleType.Godfather))
            {
                Godfather.clearAndReload();
            }
            if (player.isRole(RoleType.Mafioso))
            {
                Mafioso.clearAndReload();
            }
            if (player.isRole(RoleType.Janitor))
            {
                Janitor.clearAndReload();
            }
            if (player.isRole(RoleType.Vampire))
            {
                Vampire.clearAndReload();
            }
            if (player.isRole(RoleType.Eraser))
            {
                Eraser.clearAndReload();
            }
            if (player.isRole(RoleType.Trickster))
            {
                Trickster.clearAndReload();
            }
            if (player.isRole(RoleType.Cleaner))
            {
                Cleaner.clearAndReload();
            }
            if (player.isRole(RoleType.Warlock))
            {
                Warlock.clearAndReload();
            }
            if (player.isRole(RoleType.Witch))
            {
                Witch.clearAndReload();
            }
            if (player.isRole(RoleType.Assassin))
            {
                Assassin.clearAndReload();
            }
            if (player.isRole(RoleType.EvilHacker))
            {
                EvilHacker.clearAndReload();
            }

            // Other roles
            if (player.isRole(RoleType.Jester))
            {
                Jester.clearAndReload();
            }
            if (player.isRole(RoleType.Arsonist))
            {
                Arsonist.clearAndReload();
            }
            if (player.isRole(RoleType.Sidekick))
            {
                Sidekick.clearAndReload();
            }
            if (player.isRole(RoleType.BountyHunter))
            {
                BountyHunter.clearAndReload();
            }
            if (player.isRole(RoleType.Vulture))
            {
                Vulture.clearAndReload();
            }
            if (player.isRole(RoleType.Lawyer))
            {
                Lawyer.clearAndReload();
            }
            if (player.isRole(RoleType.Pursuer))
            {
                Pursuer.clearAndReload();
            }
            if (Guesser.isGuesser(player.PlayerId))
            {
                Guesser.clear(player.PlayerId);
            }


            if (player.isRole(RoleType.Jackal))
            { // Promote Sidekick and hence override the the Jackal or erase Jackal
                if (Sidekick.promotesToJackal && Sidekick.sidekick != null && Sidekick.sidekick.isAlive())
                {
                    RPCProcedure.sidekickPromotes();
                }
                else
                {
                    Jackal.clearAndReload();
                }
            }
        }