예제 #1
0
 public override void OnEnter()
 {
     base.OnEnter();
     treasureMain = Owner.GetComponent <TreasureMain>();
     // 毎回閉じるか
     treasureMain.ButtonClose();
 }
예제 #2
0
    public static AdventureMeta UseItem(TreasureMain itemToUse, AdventureMeta meta, int rosterPos, List <SkillMeta> skills)
    {
        /*
         * Verify item is in the list
         * update adventure meta
         */
        if (itemToUse != null)
        {
            switch (itemToUse.monTreas.effects)
            {
            case MonTreasMeta.Type.Exp:
                meta.roster[rosterPos].exp += itemToUse.monTreas.value;
                break;

            case MonTreasMeta.Type.Heal:
                Debug.Log("Healing: " + itemToUse.monTreas.value.ToString());
                //For some reason, there's a bug here
                //meta.roster[rosterPos].curHealth += itemToUse.monTreas.value;
                meta.roster[rosterPos].curHealth += 10;
                if (meta.roster[rosterPos].curHealth > meta.roster[rosterPos].maxHealth)
                {
                    meta.roster[rosterPos].curHealth = meta.roster[rosterPos].maxHealth;
                }
                break;

            //case MonTreasMeta.Type.Money:
            //meta.addYen(itemToUse.monTreas.value);
            //break;
            case MonTreasMeta.Type.Revive:
                if (meta.roster[rosterPos].curHealth <= 0)
                {
                    meta.roster[rosterPos].curHealth = meta.roster[rosterPos].maxHealth / 2;
                }
                break;

            case MonTreasMeta.Type.Skills:
                PanelManager.instance.FillSkills();
                break;

            case MonTreasMeta.Type.Stats:
                meta.roster[rosterPos].AddToLowest(1);
                break;

            case MonTreasMeta.Type.XBuff:
                BoardManager.instance.buff(itemToUse.monTreas.value);
                break;

            default:
                break;
            }
        }


        return(meta);
    }
예제 #3
0
    public static bool CanUseItem(TreasureMain itemToUse, AdventureMeta meta, int rosterPos, List <SkillMeta> skills)
    {
        switch (itemToUse.monTreas.effects)
        {
        case MonTreasMeta.Type.Exp:
            return(false);

        case MonTreasMeta.Type.Heal:
            if (meta.roster[rosterPos].curHealth > 0)
            {
                return(true);
            }
            return(false);

        case MonTreasMeta.Type.Revive:
            if (meta.roster[rosterPos].curHealth <= 0)
            {
                return(true);
            }
            return(false);

        case MonTreasMeta.Type.Skills:
            bool hasEmpty = false;
            foreach (SkillMeta skill in skills)
            {
                if (skill.req1.has < skill.req1.req || skill.req2.has < skill.req2.req)
                {
                    hasEmpty = true;
                }
            }
            return(hasEmpty);

        case MonTreasMeta.Type.Stats:
            return(true);

        case MonTreasMeta.Type.XBuff:
            return(true);

        default:
            return(false);
        }
    }