Beispiel #1
0
 private bool CheckPos(ObjectPos woodpos)
 {
     if (SolidBoxList.ContainsKey(woodpos))
     {
         return(false);
     }
     if (IceList.ContainsKey(woodpos))
     {
         return(false);
     }
     if (PitfulList.ContainsKey(woodpos))
     {
         return(false);
     }
     if (WoodBoxList.ContainsKey(woodpos))
     {
         return(false);
     }
     if (ItemList.ContainsKey(woodpos))
     {
         return(false);
     }
     if (SpecialPointList.ContainsKey(woodpos))
     {
         return(false);
     }
     return(true);
 }
 private void SelectValue()
 {
     if (ItemList.ContainsKey(myValue))
     {
         TreeViewItemEx item = ItemList[myValue];
         item.IsSelected = true;
         if (!item.IsVisible)
         {
             if (item.Parent is TreeViewItemEx)
             {
                 TreeViewItemEx p = (TreeViewItemEx)item.Parent;
                 while (p != null)
                 {
                     p.IsExpanded = true;
                     if (p.Parent is TreeViewItemEx)
                     {
                         p = (TreeViewItemEx)p.Parent;
                     }
                     else
                     {
                         p = null;
                     }
                 }
             }
         }
     }
     else
     {
         if (SelectedItem != null)
         {
             TreeViewItemEx item = (TreeViewItemEx)this.SelectedItem;
             item.IsSelected = false;
         }
     }
 }
Beispiel #3
0
 private bool checkPosition(ObjectPos pos)
 {
     if (WoodBoxList.ContainsKey(pos))
     {
         return(false);
     }
     if (SolidBoxList.ContainsKey(pos))
     {
         return(false);
     }
     if (SpecialBoxList.ContainsKey(pos))
     {
         return(false);
     }
     if (ItemList.ContainsKey(pos))
     {
         return(false);
     }
     if (IceList.ContainsKey(pos))
     {
         return(false);
     }
     if (BaseList.ContainsKey(pos))
     {
         return(false);
     }
     return(true);
 }
 /// <summary>
 /// Determines whether specified weapon has been purchased
 /// </summary>
 /// <param name="id">the weapon id</param>
 /// <param name="weaponList">list of weapons to check from</param>
 /// <returns></returns>
 public bool IsWeaponPurchased(string id, ItemList weaponList)
 {
     if (!weaponList.ContainsKey(id))
     {
         return(false);
     }
     return(m_DataStore.IsWeaponPurchased(id));
 }
 /// <summary>
 /// Purchases a booster item, and adds it to inventory
 /// </summary>
 /// <param name="id"></param>
 /// <param name="item"></param>
 /// <param name="list"></param>
 public void PurchaseItem(string id, LootItem item, ItemList list)
 {
     if (!list.ContainsKey(id))
     {
         return;
     }
     m_DataStore.PurchaseItem(id, item);
     SaveData();
 }
 /// <summary>
 /// Method used for upgrading selected weapon
 /// </summary>
 /// <param name="id">weapon id</param>
 /// <param name="weapon">weapon object to upgrade</param>
 /// <param name="weaponList">list from which to upgrade</param>
 public void UpgradeWeapon(string id, LootItem weapon, ItemList weaponList)
 {
     if (!weaponList.ContainsKey(id))
     {
         return;
     }
     m_DataStore.UpgradeWeapon(weapon);
     SaveData();
 }
 /// <summary>
 /// Method used for purchasing a weapon
 /// </summary>
 /// <param name="id">id for the weapon to purchase</param>
 /// <param name="weaponList">list of weapons to purchase from</param>
 public void PurchaseWeapon(string id, LootItem weapon, ItemList weaponList)
 {
     if (!weaponList.ContainsKey(id))
     {
         return;
     }
     m_DataStore.PurchaseWeapon(id, weapon);
     SaveData();
 }
Beispiel #8
0
 private void destroyItem(ObjectPos itempos)
 {
     if (ItemList.ContainsKey(itempos))
     {
         var ItemNumber = ItemList [itempos].GetComponent <ItemAttribute> ().GetItemNumber();
         if (ItemNumber != 8 && ItemNumber != 9)
         {
             Destroy(ItemList [itempos]);
         }
     }
     destroyPlayer(itempos.x, itempos.y);
 }
Beispiel #9
0
 //アイテムを持たせたり減らしたりする。持ち物制限とかはここら辺でやる。(10種類以上は持たせないみたいな)
 //オペレーターのオーバーライドですっきりにしたいけど、読んでないからとりあえずこれ。一応消せなかったらfalseが戻り値だけど、使ってない。
 public void AddItem(Item i)
 {
     if (ItemList.ContainsKey(i.Name))
     {
         //キャラのアイテムリストにアイテムがあれば個数分増やす
         ItemList[i.Name].Count += i.Count;
     }
     else
     {
         //キャラのアイテムリストにアイテムがなければ、アイテムを増やす。
         ItemList.Add(i.Name, i);
     }
 }
Beispiel #10
0
        public bool RemoveItem(Item i)
        {
            if (ItemList.ContainsKey(i.Name))
            {
                //キャラのアイテムリストにアイテムがあれば個数分減らす。
                //なお、countは0以下にならないので減らすだけなら問題ない。売るときは問題になる。
                ItemList[i.Name].Count -= i.Count;

                //個数が0なら消す
                CheckItemlist();

                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #11
0
    private int destroyItem(Vector3 nextpos, int leftRange)
    {
        GameObject fire = (GameObject)Instantiate(prefab [0], nextpos, Quaternion.identity);

        objectPos.x = nextpos.x;
        objectPos.y = nextpos.y;
        if (WoodBoxList.ContainsKey(objectPos))
        {
            Destroy(WoodBoxList[objectPos]);
            leftRange = 1;
        }
        if (SpecialBoxList.ContainsKey(objectPos))
        {
            Destroy(SpecialBoxList[objectPos]);
            leftRange = 1;
        }
        if (BombList.ContainsKey(objectPos))
        {
            Destroy(BombList[objectPos]);
        }
        if (ItemList.ContainsKey(objectPos))
        {
            var ItemNumber = ItemList [objectPos].GetComponent <ItemAttribute> ().GetItemNumber();
            if (ItemNumber != 8 && ItemNumber != 9)
            {
                Destroy(ItemList [objectPos]);
            }
        }
        if (BaseList.ContainsKey(objectPos))
        {
            BaseList [objectPos].GetComponent <BaseAttribute> ().DamageBase();
        }
        destroyPlayer(objectPos.x, objectPos.y);
        nextpos.y++;
        leftRange--;
        return(leftRange);
    }
Beispiel #12
0
    // Update is called once per frame
    void Update()
    {
        if (GameOver)
        {
            return;
        }
        var T      = GetComponent <Transform> ();
        var offset = GetComponent <BoxCollider2D> ().offset;
        var pos    = new Vector3(
            T.position.x,
            T.position.y + offset.y * T.localScale.y,
            T.position.z);

        playerPos.x = Mathf.Round(pos.x);
        playerPos.y = Mathf.Round(pos.y);
        var  reverse = 1;
        bool move    = false;

        if (!GetComponent <PlayerAttribute> ().GetSpeedPower())
        {
            if (PitfulList.ContainsKey(playerPos))
            {
                ani.speed = 1.7f;
            }
            else
            {
                ani.speed = GetComponent <PlayerAttribute> ().GetSpeed();
            }
            if (GetComponent <PlayerAttribute> ().GetReverse())
            {
                reverse = -1;
            }
            if (Input.GetKey(playerDirec.down))
            {
                if (reverse == -1)
                {
                    ani.SetInteger("Direction", 2);
                }
                else
                {
                    ani.SetInteger("Direction", 1);
                }
                p.velocity = new Vector2(0, -ani.speed * reverse);
                move       = true;
            }
            if (Input.GetKeyUp(playerDirec.down))
            {
                p.velocity = new Vector2(0, 0);
                ani.speed  = 0;
            }
            if (Input.GetKey(playerDirec.up))
            {
                if (reverse == -1)
                {
                    ani.SetInteger("Direction", 1);
                }
                else
                {
                    ani.SetInteger("Direction", 2);
                }
                p.velocity = new Vector2(0, ani.speed * reverse);
                move       = true;
            }
            if (Input.GetKeyUp(playerDirec.up))
            {
                p.velocity = new Vector2(0, 0);
                ani.speed  = 0;
            }
            if (Input.GetKey(playerDirec.left))
            {
                if (reverse == -1)
                {
                    ani.SetInteger("Direction", 3);
                }
                else
                {
                    ani.SetInteger("Direction", 4);
                }
                p.velocity = new Vector2(-ani.speed * reverse, 0);
                move       = true;
            }
            if (Input.GetKeyUp(playerDirec.left))
            {
                p.velocity = new Vector2(0, 0);
                ani.speed  = 0;
            }
            if (Input.GetKey(playerDirec.right))
            {
                if (reverse == -1)
                {
                    ani.SetInteger("Direction", 4);
                }
                else
                {
                    ani.SetInteger("Direction", 3);
                }
                p.velocity = new Vector2(ani.speed * reverse, 0);
                move       = true;
            }
            if (Input.GetKeyUp(playerDirec.right))
            {
                p.velocity = new Vector2(0, 0);
                ani.speed  = 0;
            }
        }
        if (move == false)
        {
            return;
        }
        pos = new Vector3(
            T.position.x,
            T.position.y + offset.y * T.localScale.y,
            T.position.z);
        itempos.x = Mathf.Round(pos.x);
        itempos.y = Mathf.Round(pos.y);
        if (ItemList.ContainsKey(itempos))
        {
            var ItemType = ItemList [itempos].GetComponent <ItemAttribute> ().GetItemNumber();

            switch (ItemType)
            {
            case 0:
                source.PlayOneShot(collection, 0.7f);
                var starsNumber1 = GetComponent <PlayerAttribute> ().GetNumberOfStars();
                GetComponent <PlayerAttribute> ().SetNumberOfStars(starsNumber1 + 20);
                break;

            case 1:
                source.PlayOneShot(collection, 0.7f);
                var starsNumber2 = GetComponent <PlayerAttribute> ().GetNumberOfStars();
                GetComponent <PlayerAttribute> ().SetNumberOfStars(starsNumber2 + 50);
                break;

            case 2:
                source.PlayOneShot(collection, 0.7f);
                var NumberOfBomb     = GetComponent <PlayerAttribute> ().GetNumberOfBombs();
                var LeftNumberOfBomb = GetComponent <PlayerAttribute> ().GetLeftBombNumber();
                if (NumberOfBomb == 8)
                {
                    break;
                }
                GetComponent <PlayerAttribute> ().SetNumberOfBombs(NumberOfBomb + 1);
                GetComponent <PlayerAttribute> ().SetLeftBombNumber(LeftNumberOfBomb + 1);
                break;

            case 3:
                source.PlayOneShot(collection, 0.7f);
                var SpeedOfPlayer = GetComponent <PlayerAttribute> ().GetSpeed();
                if (SpeedOfPlayer == 6.0f)
                {
                    break;
                }
                if (SpeedOfPlayer == 2.0f)
                {
                    SpeedOfPlayer = 3.2f;
                }
                else if (SpeedOfPlayer == 3.2f)
                {
                    SpeedOfPlayer = 4.0f;
                }
                else if (SpeedOfPlayer == 4.0f)
                {
                    SpeedOfPlayer = 4.8f;
                }
                else if (SpeedOfPlayer == 4.8f)
                {
                    SpeedOfPlayer = 5.4f;
                }
                else if (SpeedOfPlayer == 6.0f)
                {
                    SpeedOfPlayer = 6.0f;
                }
                GetComponent <PlayerAttribute> ().SetSpeed(SpeedOfPlayer);
                break;

            case 4:
                source.PlayOneShot(collection, 0.7f);
                var RangeOfBomb1 = GetComponent <PlayerAttribute> ().GetRangeOfBomb();
                if (RangeOfBomb1 == 7)
                {
                    break;
                }
                GetComponent <PlayerAttribute> ().SetRangeOfBomb(RangeOfBomb1 + 1);
                break;

            case 5:
                source.PlayOneShot(collection, 0.7f);
                var RangeOfBomb2 = GetComponent <PlayerAttribute> ().GetRangeOfBomb();
                if (RangeOfBomb2 == 7)
                {
                    break;
                }
                int rangeCurrent1 = RangeOfBomb2 + 2 > 7 ? 7 : RangeOfBomb2 + 2;
                GetComponent <PlayerAttribute> ().SetRangeOfBomb(rangeCurrent1);
                break;

            case 6:
                source.PlayOneShot(collection, 0.7f);
                var RangeOfBomb3 = GetComponent <PlayerAttribute> ().GetRangeOfBomb();
                if (RangeOfBomb3 == 7)
                {
                    break;
                }
                int rangeCurrent2 = RangeOfBomb3 + 2 > 7 ? 7 : RangeOfBomb3 + 5;
                GetComponent <PlayerAttribute> ().SetRangeOfBomb(rangeCurrent2);
                break;

            case 7:
                source.PlayOneShot(collection, 0.7f);
                var NumberOfSpecialObject = GetComponent <PlayerAttribute> ().GetSpecialObject();
                GetComponent <PlayerAttribute> ().SetSpecialObject(NumberOfSpecialObject + 1);
                break;

            case 8:
                source.PlayOneShot(collection, 0.7f);
                GetComponent <PlayerAttribute> ().SetReverse(true);
                break;

            case 9:
                source.PlayOneShot(banana, 0.7f);
                var dir = ani.GetInteger("Direction");
                ani.speed = 20;
                GetComponent <PlayerAttribute> ().SetSpeedPower(true);
                switch (dir)
                {
                case 1:
                    p.velocity = new Vector2(0, -ani.speed);
                    break;

                case 2:
                    p.velocity = new Vector2(0, ani.speed);
                    break;

                case 3:
                    p.velocity = new Vector2(ani.speed, 0);
                    break;

                default:
                    p.velocity = new Vector2(-ani.speed, 0);
                    break;
                }
                break;

            case 10:
                source.PlayOneShot(collection, 0.7f);
                var starsNumber3 = GetComponent <PlayerAttribute> ().GetNumberOfStars();
                GetComponent <PlayerAttribute> ().SetNumberOfStars(starsNumber3 + 200);
                break;

            default:
                break;
            }
            Destroy(ItemList [itempos]);
        }
    }
Beispiel #13
0
 /// <summary>
 /// </summary>
 /// <param name="key"></param>
 /// <returns></returns>
 public bool ContainsItem(string key)
 {
     return(items.ContainsKey(key));
 }
Beispiel #14
0
        public static short GetItemAbility(MItem item, int eff)
        {
            int result = 0;
            int itemId = item.Index;

            if (!ItemList.ContainsKey(itemId))
            {
                return(0);
            }

            int unique = ItemList[itemId].Unique;
            int pos    = ItemList[itemId].Pos;

            if (eff == MItemDefinition.DAMAGEADD || eff == MItemDefinition.MAGICADD)
            {
                if (unique < 41 || unique > 50)
                {
                    return(0);
                }
            }

            if (eff == MItemDefinition.CRITICAL)
            {
                if (item.Effects[1].Index == MItemDefinition.CRITICAL2 || item.Effects[2].Index == MItemDefinition.CRITICAL2)
                {
                    eff = MItemDefinition.CRITICAL2;
                }
            }

            if (eff == MItemDefinition.DAMAGE && pos == 32)
            {
                if (item.Effects[1].Index == MItemDefinition.DAMAGE2 || item.Effects[2].Index == MItemDefinition.DAMAGE2)
                {
                    eff = MItemDefinition.DAMAGE2;
                }
            }

            if (eff == MItemDefinition.MPADD2)
            {
                if (item.Effects[1].Index == MItemDefinition.MPADD2 || item.Effects[2].Index == MItemDefinition.MPADD2)
                {
                    eff = MItemDefinition.MPADD2;
                }
            }

            if (eff == MItemDefinition.ACADD)
            {
                if (item.Effects[1].Index == MItemDefinition.ACADD2 || item.Effects[2].Index == MItemDefinition.ACADD2)
                {
                    eff = MItemDefinition.ACADD2;
                }
            }

            if (eff == MItemDefinition.LEVEL && itemId >= 2330 && itemId < 2360)
            {
                result = item.Effects[1].Index - 1;
            }
            else if (eff == MItemDefinition.LEVEL)
            {
                result += ItemList[itemId].Level;
            }

            if (eff == MItemDefinition.REQ_STR)
            {
                result += ItemList[itemId].Str;
            }
            if (eff == MItemDefinition.REQ_INT)
            {
                result += ItemList[itemId].Int;
            }
            if (eff == MItemDefinition.REQ_CON)
            {
                result += ItemList[itemId].Con;
            }
            if (eff == MItemDefinition.REQ_DEX)
            {
                result += ItemList[itemId].Dex;
            }

            if (eff == MItemDefinition.POS)
            {
                result += ItemList[itemId].Pos;
            }

            if (eff != MItemDefinition.INCUBATE)
            {
                foreach (var i in ItemList[itemId].Effect)
                {
                    if (i.Index != eff)
                    {
                        continue;
                    }

                    int val = i.Value;
                    if (eff == MItemDefinition.ATTSPEED && val == 1)
                    {
                        val = 10;
                    }

                    result += val;
                    break;
                }
            }

            // parte de montarias não feito
            for (int i = 0; i < 3; i++)
            {
                if (item.Effects[i].Index != eff)
                {
                    continue;
                }

                int val = item.Effects[i].Value;
                if (eff == MItemDefinition.ATTSPEED && val == 1)
                {
                    val = 10;
                }

                result += val;
            }

            if (eff >= MItemDefinition.RESIST1 && eff <= MItemDefinition.RESIST4)
            {
                foreach (var i in ItemList[itemId].Effect)
                {
                    if (i.Index != MItemDefinition.RESISTALL)
                    {
                        continue;
                    }

                    result += i.Value;
                }

                for (int i = 0; i < 3; i++)
                {
                    if (item.Effects[i].Index != MItemDefinition.RESISTALL)
                    {
                        continue;
                    }

                    result += item.Effects[i].Value;
                    break;
                }
            }

            return((short)result);
        }