Exemplo n.º 1
0
        //コピーコンストラクタ
        public ProtectionItem(ProtectionItem other)
            : base(other.itemID, other.itemName, other.itemExplanation,
                   other.itemPrice, other.itemRare, other.itemWeight, other.amountLimit)
        {
            this.protectionType = other.protectionType;

            effect = new EquipmentEffect(other.itemPower, other.itemDefense, other.reinforcementLimit,
                                         other.upPower, other.upDefense, other.randomMinP, other.randomMaxP, other.randomMinD, other.randomMaxD);
        }
Exemplo n.º 2
0
        public override Item UniqueClone()
        {
            ProtectionItem newItem = new ProtectionItem(itemID, itemName, itemExplanation,
                                                        itemPrice, itemRare, itemWeight, protectionType,
                                                        effect.GetPower() - effect.GetAddPower(), effect.GetDefense() - effect.GetAddDefense(),
                                                        effect.GetReinforcement(), effect.GetReinforcementLimit(), effect.GetUpPower(), effect.GetUpDefence(),
                                                        effect.GetAddPower(), effect.GetAddDefense());

            return(newItem);
        }
Exemplo n.º 3
0
        public void Load(int[] equipmentIDs, int[] consuptionIDs)
        {
            Clear();

            //装備読み込み
            FileStream   datefs        = new FileStream(equipmentFilename, FileMode.Open);
            StreamReader equipmentDate = new StreamReader(datefs, Encoding.GetEncoding("shift_jis"));

            //装備生成
            while (!equipmentDate.EndOfStream)
            {
                string   line  = equipmentDate.ReadLine();
                string[] items = line.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
                if (items.Length != 17)
                {
                    continue;
                }

                int id = int.Parse(items[0]);

                if (!equipmentIDs.Contains(id))
                {
                    continue;
                }

                string itemName        = items[1];
                string itemExplanation = items[2];
                itemExplanation = itemExplanation.Replace("nl", "\n");
                int    itemPrice          = int.Parse(items[3]);
                int    itemRare           = int.Parse(items[4]);
                float  itemWeight         = float.Parse(items[5]);
                string type               = items[6];
                int    power              = int.Parse(items[7]);
                int    defence            = int.Parse(items[8]);
                int    reinforcement      = int.Parse(items[9]);
                int    reinforcementLimit = int.Parse(items[10]);
                int    upPower            = int.Parse(items[11]);
                int    upDefence          = int.Parse(items[12]);
                int    randMinP           = int.Parse(items[13]);
                int    randMaxP           = int.Parse(items[14]);
                int    randMinD           = int.Parse(items[15]);
                int    randMaxD           = int.Parse(items[16]);

                if (type == "Sword")
                {
                    equipments[id] = new WeaponItem(id, itemName, itemExplanation,
                                                    itemPrice, itemRare, itemWeight, WeaponItem.WeaponType.Sword,
                                                    power, defence, reinforcement, reinforcementLimit,
                                                    upPower, upDefence, randMinP, randMaxP, randMinD, randMaxD);
                }
                else if (type == "Bow")
                {
                    equipments[id] = new WeaponItem(id, itemName, itemExplanation,
                                                    itemPrice, itemRare, itemWeight, WeaponItem.WeaponType.Bow,
                                                    power, defence, reinforcement, reinforcementLimit,
                                                    upPower, upDefence, randMinP, randMaxP, randMinD, randMaxD);
                }
                else if (type == "Dagger")
                {
                    equipments[id] = new WeaponItem(id, itemName, itemExplanation,
                                                    itemPrice, itemRare, itemWeight, WeaponItem.WeaponType.Dagger,
                                                    power, defence, reinforcement, reinforcementLimit,
                                                    upPower, upDefence, randMinP, randMaxP, randMinD, randMaxD);
                }
                else if (type == "Shield")
                {
                    equipments[id] = new WeaponItem(id, itemName, itemExplanation,
                                                    itemPrice, itemRare, itemWeight, WeaponItem.WeaponType.Shield,
                                                    power, defence, reinforcement, reinforcementLimit,
                                                    upPower, upDefence, randMinP, randMaxP, randMinD, randMaxD);
                }
                else if (type == "Helm")
                {
                    equipments[id] = new ProtectionItem(id, itemName, itemExplanation,
                                                        itemPrice, itemRare, itemWeight, ProtectionItem.ProtectionType.Helm,
                                                        power, defence, reinforcement, reinforcementLimit,
                                                        upPower, upDefence, randMinP, randMaxP, randMinD, randMaxD);
                }
                else if (type == "Armor")
                {
                    equipments[id] = new ProtectionItem(id, itemName, itemExplanation,
                                                        itemPrice, itemRare, itemWeight, ProtectionItem.ProtectionType.Armor,
                                                        power, defence, reinforcement, reinforcementLimit,
                                                        upPower, upDefence, randMinP, randMaxP, randMinD, randMaxD);
                }
                else if (type == "Glove")
                {
                    equipments[id] = new ProtectionItem(id, itemName, itemExplanation,
                                                        itemPrice, itemRare, itemWeight, ProtectionItem.ProtectionType.Glove,
                                                        power, defence, reinforcement, reinforcementLimit,
                                                        upPower, upDefence, randMinP, randMaxP, randMinD, randMaxD);
                }
                else if (type == "Shoes")
                {
                    equipments[id] = new ProtectionItem(id, itemName, itemExplanation,
                                                        itemPrice, itemRare, itemWeight, ProtectionItem.ProtectionType.Shoes,
                                                        power, defence, reinforcement, reinforcementLimit,
                                                        upPower, upDefence, randMinP, randMaxP, randMinD, randMaxD);
                }
            }
            equipmentDate.Close();
            datefs.Close();


            //消費アイテム読み込み
            datefs = new FileStream(consuptionFilename, FileMode.Open);
            StreamReader consuptionDate = new StreamReader(datefs, Encoding.GetEncoding("shift_jis"));

            while (!consuptionDate.EndOfStream)
            {
                string   line  = consuptionDate.ReadLine();
                string[] items = line.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
                if (items.Length != 9)
                {
                    continue;
                }

                int id = int.Parse(items[0]);

                if (!consuptionIDs.Contains(id))
                {
                    continue;
                }

                string itemName        = items[1];
                string itemExplanation = items[2];
                itemExplanation = itemExplanation.Replace("nl", "\n");
                int    itemPrice   = int.Parse(items[3]);
                int    itemRare    = int.Parse(items[4]);
                float  itemWeight  = float.Parse(items[5]);
                int    amountLimit = int.Parse(items[6]);
                string type        = items[7];
                int    amount      = int.Parse(items[8]);

                if (type == "recovary")
                {
                    consumptions[id] = new ConsumptionItem(id, itemName, itemExplanation,
                                                           itemPrice, itemRare, itemWeight, amountLimit,
                                                           ConsumptionItem.ItemEffectType.recovery,
                                                           new Recovery(amount));
                }
                else if (type == "damage")
                {
                    consumptions[id] = new ConsumptionItem(id, itemName, itemExplanation,
                                                           itemPrice, itemRare, itemWeight, amountLimit,
                                                           ConsumptionItem.ItemEffectType.damage,
                                                           new Damage(amount));
                }
                else if (type == "arrow")
                {
                    consumptions[id] = ((new ConsumptionItem(id, itemName, itemExplanation,
                                                             itemPrice, itemRare, itemWeight, amountLimit,
                                                             ConsumptionItem.ItemEffectType.arrow,
                                                             new ArrowEffect(amount))));
                }
                else if (type == "noEffect")
                {
                    consumptions[id] = new ConsumptionItem(id, itemName, itemExplanation,
                                                           itemPrice, itemRare, itemWeight, amountLimit,
                                                           ConsumptionItem.ItemEffectType.noEffect,
                                                           new NoEffect());
                }
            }
            consuptionDate.Close();
            datefs.Close();

            //アクセサリーアイテム読み込み
            //datefs = new FileStream(accessaryFilename, FileMode.Open);
            //StreamReader accessaryDate = new StreamReader(datefs, Encoding.GetEncoding("shift_jis"));

            //while (!accessaryDate.EndOfStream)
            //{
            //    string line = accessaryDate.ReadLine();
            //    string[] items = line.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
            //    if (items.Length != 9) continue;

            //    int id = int.Parse(items[0]);

            //    if (!accessaryIDs.Contains(id)) continue;

            //    string itemName = items[1];
            //    string itemExplanation = items[2];
            //    itemExplanation = itemExplanation.Replace("nl", "\n");
            //    int itemPrice = int.Parse(items[3]);
            //    int itemRare = int.Parse(items[4]);
            //    float itemWeight = float.Parse(items[5]);
            //    int amountLimit = int.Parse(items[6]);
            //    string type = items[7];
            //    int intType = -1;

            //    //アクセサリーアイテムの種類を追加したらここにif文を追加する。
            //    if (type == "Earring")
            //    {
            //        intType = 0;
            //    }

            //    accessarys[id] = (new AccessaryItem(id, itemName, itemExplanation, itemPrice, itemRare, itemWeight, amountLimit, intType));
            //}
            //accessaryDate.Close();
            //datefs.Close();
        }
Exemplo n.º 4
0
        //指定されたアイテムをロード
        public void LoadEquipment(int selectID)
        {
            Clear();

            //装備読み込み
            FileStream   datefs        = new FileStream(equipmentFilename, FileMode.Open);
            StreamReader equipmentDate = new StreamReader(datefs, Encoding.GetEncoding("shift_jis"));

            //装備生成
            while (!equipmentDate.EndOfStream)
            {
                string   line  = equipmentDate.ReadLine();
                string[] items = line.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
                if (items.Length != 17)
                {
                    continue;
                }

                int id = int.Parse(items[0]);

                if (selectID != id)
                {
                    continue;
                }

                string itemName        = items[1];
                string itemExplanation = items[2];
                itemExplanation = itemExplanation.Replace("nl", "\n");
                int    itemPrice          = int.Parse(items[3]);
                int    itemRare           = int.Parse(items[4]);
                float  itemWeight         = float.Parse(items[5]);
                string type               = items[6];
                int    power              = int.Parse(items[7]);
                int    defence            = int.Parse(items[8]);
                int    reinforcement      = int.Parse(items[9]);
                int    reinforcementLimit = int.Parse(items[10]);
                int    upPower            = int.Parse(items[11]);
                int    upDefence          = int.Parse(items[12]);
                int    randMinP           = int.Parse(items[13]);
                int    randMaxP           = int.Parse(items[14]);
                int    randMinD           = int.Parse(items[15]);
                int    randMaxD           = int.Parse(items[16]);

                if (type == "Sword")
                {
                    equipment[id] = new WeaponItem(id, itemName, itemExplanation,
                                                   itemPrice, itemRare, itemWeight, WeaponItem.WeaponType.Sword,
                                                   power, defence, reinforcement, reinforcementLimit,
                                                   upPower, upDefence, randMinP, randMaxP, randMinD, randMaxD);
                }
                else if (type == "Bow")
                {
                    equipment[id] = new WeaponItem(id, itemName, itemExplanation,
                                                   itemPrice, itemRare, itemWeight, WeaponItem.WeaponType.Bow,
                                                   power, defence, reinforcement, reinforcementLimit,
                                                   upPower, upDefence, randMinP, randMaxP, randMinD, randMaxD);
                }
                else if (type == "Dagger")
                {
                    equipment[id] = new WeaponItem(id, itemName, itemExplanation,
                                                   itemPrice, itemRare, itemWeight, WeaponItem.WeaponType.Dagger,
                                                   power, defence, reinforcement, reinforcementLimit,
                                                   upPower, upDefence, randMinP, randMaxP, randMinD, randMaxD);
                }
                else if (type == "Shield")
                {
                    equipment[id] = new WeaponItem(id, itemName, itemExplanation,
                                                   itemPrice, itemRare, itemWeight, WeaponItem.WeaponType.Shield,
                                                   power, defence, reinforcement, reinforcementLimit,
                                                   upPower, upDefence, randMinP, randMaxP, randMinD, randMaxD);
                }
                else if (type == "Helm")
                {
                    equipment[id] = new ProtectionItem(id, itemName, itemExplanation,
                                                       itemPrice, itemRare, itemWeight, ProtectionItem.ProtectionType.Helm,
                                                       power, defence, reinforcement, reinforcementLimit,
                                                       upPower, upDefence, randMinP, randMaxP, randMinD, randMaxD);
                }
                else if (type == "Armor")
                {
                    equipment[id] = new ProtectionItem(id, itemName, itemExplanation,
                                                       itemPrice, itemRare, itemWeight, ProtectionItem.ProtectionType.Armor,
                                                       power, defence, reinforcement, reinforcementLimit,
                                                       upPower, upDefence, randMinP, randMaxP, randMinD, randMaxD);
                }
                else if (type == "Glove")
                {
                    equipment[id] = new ProtectionItem(id, itemName, itemExplanation,
                                                       itemPrice, itemRare, itemWeight, ProtectionItem.ProtectionType.Glove,
                                                       power, defence, reinforcement, reinforcementLimit,
                                                       upPower, upDefence, randMinP, randMaxP, randMinD, randMaxD);
                }
                else
                {
                    equipment[id] = new ProtectionItem(id, itemName, itemExplanation,
                                                       itemPrice, itemRare, itemWeight, ProtectionItem.ProtectionType.Shoes,
                                                       power, defence, reinforcement, reinforcementLimit,
                                                       upPower, upDefence, randMinP, randMaxP, randMinD, randMaxD);
                }
            }
            equipmentDate.Close();
            datefs.Close();
        }