Beispiel #1
0
    public void giveReward(PlayerInventory inven, PlayerAttributes attr)
    {
        Item itemToAdd = new HealItem("Potion", 0, itemTypes.HealItem, 10);

        switch (reward)
        {
        case rewards.coins:
            itemToAdd = new Money("CoinBag", rewardAmount, itemTypes.Coin, coinAmount.coinBag);
            break;

        case rewards.potion:
            itemToAdd = new HealItem("Potion", rewardAmount, itemTypes.HealItem, 10);
            break;

        case rewards.poison:
            itemToAdd = new HealItem("Poison", rewardAmount, itemTypes.HealItem, -5);
            break;

        default:
            itemToAdd = new HealItem("Potion", 0, itemTypes.HealItem, 10);
            break;
        }
        inven.addItem(itemToAdd);
        attr.finishQuest(this);
    }
Beispiel #2
0
    public override void Heal(int heal, GameObject source)
    {
        base.Heal(heal, source);
        HealItem healItem = source.GetComponent <HealItem>();

        if (healItem)
        {
            healEffect = Instantiate(healItem.healParticule, gameObject.transform);
            Destroy(healEffect, 3);
        }
    }
Beispiel #3
0
    //For Battles, need to make one for overworld
    public void SelectItem()
    {
        if (isHeal)
        {
            SelectAttack.instance.selectOption();
            Debug.Log("Clicked and Ready");
            HealItem healScript = GameObject.Find("Items").GetComponent <HealItem>();
            healScript.icon        = icon.sprite;
            healScript.hpHeal      = item.healAmount;
            healScript.staminaHeal = item.staminaAmount;
            healScript.hungery     = item.hungery;
            healScript.thirsty     = item.thirsty;

            BattleManager.instance.itemScript = healScript;
        }
    }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        GameObject tempGo = collision.gameObject;

        if (tempGo.layer == LayerMask.NameToLayer("Item"))
        {
            switch (tempGo.tag)
            {
            case "HealItem":
                HealItem healItem = tempGo.GetComponent <HealItem>();
                IncreaseHealth(healItem.healSize);
                Destroy(healItem.gameObject);
                break;

            default:
                break;
            }
        }

        if (curState == HeroState.knockBack)
        {
            return;
        }

        if (tempGo.layer == LayerMask.NameToLayer("EnemyAttacker"))
        {
            if (tempGo == prevCollGo)
            {
                return;
            }

            prevCollGo = tempGo.transform.root.gameObject;

            Attacker enemyAttacker = tempGo.transform.parent.GetComponent <Attacker>();
            DecreaseHealth(enemyAttacker.GetDamage());
            if (health != 0)
            {
                tempGo = tempGo.transform.root.gameObject;
                KnockBack(tempGo);
                curState = HeroState.knockBack;
            }
            else
            {
                Die();
            }
        }
    }
Beispiel #5
0
    // Use this for initialization
    void Start()
    {
        attack.gameObject.SetActive(false);
        pyro.gameObject.SetActive(false);
        recov.gameObject.SetActive(false);
        sushi.gameObject.SetActive(false);

        healthtext.gameObject.SetActive(false);

        enCount  = enemies.Length;
        gameOver = false;
        sceneNum = SceneManager.GetActiveScene().buildIndex;
        i        = 0;
        recovpo  = FindObjectOfType <Recovpo>();
        dmgSpell = FindObjectOfType <DamageNinpo>();
        healItem = FindObjectOfType <HealItem>();
    }
Beispiel #6
0
    //Resources.Load<GameObject>(item.WorldObj)
    //Resources.Load<Sprite>(item.Icon)

    private void CreateHealItem(string title, int stackSize, int id, int healPower)// id 1000-1999
    {
        HealItem item = new HealItem {
            Title = title, StackSize = stackSize, Id = id, HealPower = healPower
        };

        item.Icon = "ItemSprite/" + id;
        if (item.Icon == null)
        {
            item.Icon = "ItemSprite/Unknown";
        }

        item.WorldObj = "ItemObj/" + id;
        if (item.WorldObj == null)
        {
            item.WorldObj = "ItemObj/Unknown";
        }

        IDB.Add(item);
    }
Beispiel #7
0
 // Start is called before the first frame update
 void Start()
 {
     player   = GameObject.Find("Player");
     moneyBar = GameObject.Find("MoneyBar");
     if (!isLoaded)
     {
         items    = new Item[10];
         items[0] = new Weapon("Sword", 1, itemTypes.Weapon, 7, 0.4f, 1);
         items[1] = new HealItem("Potion", 30, itemTypes.HealItem, 10);
         items[2] = new Tool("Hoe", 1, itemTypes.Tool, 1);
         items[3] = new Seed("Sunflower Seed", 10, itemTypes.Seed);
         setCoins(0);
         hotbar_hotbar = GameObject.Find("Hotbar_hotbar");
         for (int i = 0; i < items.Length; i++)
         {
             hotbar_hotbar.transform.GetChild(i).GetComponent <HotbarItemUser>().setItem(items[i]);
         }
         setItems(items);
     }
     GameObject.Find("GroundItem").GetComponent <GroundItemInventory>().setItem(new HealItem("Poison", 30, itemTypes.HealItem, -5));
 }
 private void TryNewOnUnityEngineObject()
 {
     // we can't call new on UnityEngine.Object deriving types and Rider knows this!
     ItemPickup animator = new ItemPickup();
     Item       item     = new HealItem();
 }
Beispiel #9
0
        private void OnLoadProfile()
        {
            if (string.IsNullOrEmpty(SelectedProfile))
            {
                return;
            }

            if (!Profiles.Contains(SelectedProfile))
            {
                return;
            }

            Profile profile = profileManager.LoadProfile(SelectedProfile);

            if (profile == null)
            {
                return;
            }

            if (profile.MapId == Session.Character.Map.Id)
            {
                Bot.Path.Clear();
                Bot.Path.AddRange(profile.Path);

                using (var graphics = Graphics.FromImage(Session.Character.Map.Preview))
                {
                    var previous = new Position(0, 0);
                    for (int i = 0; i < Bot.Path.Count; i++)
                    {
                        Position position = Bot.Path[i];

                        if (i != 0)
                        {
                            graphics.DrawLine(Pen, previous.X, previous.Y, position.X, position.Y);
                        }
                        graphics.FillRectangle(Brushes.DarkRed, position.X, position.Y, 1, 1);
                        previous = position;
                    }
                }

                Bot.MapPreview = Session.Character.Map.Preview.ToBitmapSource();
            }

            IEnumerable <Monster> monsters = Bot.Monsters.Where(x => profile.Monsters.Any(s => s == x.ModelId));

            Bot.WhitelistedMonsters.Clear();
            Bot.WhitelistedMonsters.AddRange(monsters);

            IEnumerable <Skill> buffs  = Bot.BuffSkills.Where(x => profile.BuffSkills.Any(s => s == x.Id));
            IEnumerable <Skill> skills = Bot.DamageSkills.Where(x => profile.DamageSkills.Any(s => s == x.Id));

            Bot.UsedDamageSkills.Clear();
            Bot.UsedBuffSkills.Clear();

            Bot.UsedDamageSkills.AddRange(skills);
            Bot.UsedBuffSkills.AddRange(buffs);

            IEnumerable <ItemConfiguration> healItems = Bot.HealItems.Where(x => profile.HealItems.Any(s => s.ItemId == x.Item.Id));

            foreach (ItemConfiguration configuration in healItems)
            {
                HealItem saved = profile.HealItems.First(x => x.ItemId == configuration.Item.Id);

                configuration.UseForHp     = saved.UseForHp;
                configuration.UseForMp     = saved.UseForMp;
                configuration.HpPercentage = saved.HpPercentage;
                configuration.MpPercentage = saved.MpPercentage;
            }

            Bot.UsedHealItems.Clear();
            Bot.UsedHealItems.AddRange(healItems);

            Bot.PickUpGolds          = profile.PickUpGolds;
            Bot.UseAmuletOfReturn    = profile.UseAmuletOfReturn;
            Bot.PickUpSoundFlowers   = profile.PickUpSoundFlowers;
            Bot.UseAncelloanBlessing = profile.UseAncelloanBlessing;
            Bot.UseAttackPotion      = profile.UseAttackPotion;
            Bot.UseDefencePotion     = profile.UseDefencePotion;
            Bot.UseEnergyPotion      = profile.UseEnergyPotion;
            Bot.UseExperiencePotion  = profile.UseExperiencePotion;
            Bot.UseFairyBoost        = profile.UseFairyBoost;
            Bot.UseMateBlessing      = profile.UseMateBlessing;
            Bot.UsePetFood           = profile.UsePetFood;
            Bot.UseSoulstoneBlessing = profile.UseSoulstoneBlessing;
        }