Пример #1
0
        public IList <DTOs.OutputGeneration.Day> GetMaxEmissionsPerDay(Gas gas, Coal coal, EmissionsFactor emissionsFactor)
        {
            MaxEmissionGenerators maxEmissionGenerators = new MaxEmissionGenerators();

            maxEmissionGenerators.Day = new List <DTOs.OutputGeneration.Day>();

            foreach (var gasGenerator in gas.GasGenerator)
            {
                foreach (var inputday in gasGenerator.Generation.Day)
                {
                    DTOs.OutputGeneration.Day outputDay = new DTOs.OutputGeneration.Day();
                    outputDay.Date     = inputday.Date;
                    outputDay.Name     = gasGenerator.Name;
                    outputDay.Emission = inputday.Energy * gasGenerator.EmissionsRating * emissionsFactor.Medium;
                    maxEmissionGenerators.Day.Add(outputDay);
                }
            }

            foreach (var coalGenerator in coal.CoalGenerator)
            {
                foreach (var inputday in coalGenerator.Generation.Day)
                {
                    DTOs.OutputGeneration.Day outputDay = new DTOs.OutputGeneration.Day();
                    outputDay.Date     = inputday.Date;
                    outputDay.Name     = coalGenerator.Name;
                    outputDay.Emission = inputday.Energy * coalGenerator.EmissionsRating * emissionsFactor.High;
                    maxEmissionGenerators.Day.Add(outputDay);
                }
            }
            var result = maxEmissionGenerators.Day.GroupBy(x => x.Date)
                         .SelectMany(group => group.Where(element => element.Emission == group.Max(obj => obj.Emission)));

            return(result.ToList());
        }
Пример #2
0
        void OpenBox(Mobile m)
        {
            this.Delete();
            int    rand       = Utility.Random(8);
            Item   reward     = null;
            string rewardName = null;

            if (rand == 0)
            {
                reward = new CandyCane();
            }
            else if (rand == 2)
            {
                reward = new Coal();
            }
            else if (rand == 4)
            {
                reward = new CookedBird(2);
            }
            else if (rand == 6)
            {
                //reward = new FurBedRoll();
            }
            else if (rand == 8)
            {
                reward = new BadCard();
            }
            if (reward != null)
            {
                if (rewardName == null)
                {
                    rewardName = reward.Name;
                }

                m.AddToBackpack(reward);
                m.SendLocalizedMessage(1074853, rewardName);                 // You have been given ~1_name~
            }
            else
            {
                switch (Utility.Random(3))
                {
                default:
                    m.SendMessage("Krumpus box!");
                    AOS.Damage(m, 99, 0, 100, 0, 0, 0);
                    m.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head);
                    m.PlaySound(0x307);
                    break;

                case 1:
                    m.SendMessage("The box was empty");
                    break;

                case 2:
                    Poison poison = Poison.Lethal;
                    m.ApplyPoison(m, poison);
                    m.SendMessage("A puff of green dust comes out of the box, words appear Krumpus Strikes again!");
                    break;
                }
            }
        }
Пример #3
0
    protected virtual void AttemptMove <T> (int xDir, int yDir) where T : Component
    {
        RaycastHit2D hit;
        bool         canMove = Move(xDir, yDir, out hit);

        if (hit.transform == null)
        {
            return;
        }

        T      hitComponent     = hit.transform.GetComponent <T> ();
        Coal   hitCoal          = hit.transform.GetComponent <Coal> ();
        Enemy  enemyComponent   = hit.transform.GetComponent <Enemy> ();
        Player myComponent      = GetComponent <Player> ();
        Enemy  myEnemyComponent = GetComponent <Enemy> ();
        Wall   wallComponent    = hit.transform.GetComponent <Wall> ();

        if (!canMove && hitCoal != null && enemyComponent == null)
        {
            OnCantMove(hitCoal);
        }

        if (!canMove && myEnemyComponent != null && wallComponent != null)
        {
            EnemyHitWall(wallComponent);
        }

        if (!canMove && myComponent != null && enemyComponent != null)
        {
            EnemyAttack(enemyComponent);
        }
    }
Пример #4
0
    protected override void OnCantMove <T> (T component)
    {
        Coal hitCoal = component as Coal;

        hitCoal.DamageCoal(coalDamage, this);
        animator.SetTrigger("playerChop");
        audioSource.PlayOneShot(hitSound);
    }
Пример #5
0
 public void AddCoal(Coal coal)
 {
     if (!coalList.Contains(coal))
     {
         coalList.Add(coal);
         if (isHot)
         {
             coal.Ignite();
         }
         UpdateValue();
     }
 }
Пример #6
0
        public IList <ActualHeatRates> GetActualHeatRates(Coal coal)
        {
            var actualHeatRates = new List <ActualHeatRates>();

            foreach (var coalGenerator in coal.CoalGenerator)
            {
                var actualHeatRate = new ActualHeatRates();
                actualHeatRate.HeatRate = coalGenerator.TotalHeatInput / coalGenerator.ActualNetGeneration;
                actualHeatRate.Name     = coalGenerator.Name;
                actualHeatRates.Add(actualHeatRate);
            }
            return(actualHeatRates);
        }
Пример #7
0
    public void OnTriggerExit(Collider other)
    {
        Coal component = other.gameObject.GetComponent <Coal>();

        if (component != null)
        {
            boiler.RemoveCoal(component);
        }
        Flame component2 = other.gameObject.GetComponent <Flame>();

        if (component2 != null)
        {
            boiler.RemoveFlame(component2);
        }
    }
Пример #8
0
        private ActualHeatRates GetActualHeatRates(Coal coal)
        {
            var lsActualHeatRates = new List <ActualHeatRate>();

            foreach (var generator in coal.coalGenerator)
            {
                var actualHeatRate = new ActualHeatRate
                {
                    HeatRate = generator.TotalHeatInput / generator.ActualNetGeneration, Name = generator.name
                };
                lsActualHeatRates.Add(actualHeatRate);
            }
            return(new ActualHeatRates()
            {
                actualHeatRate = lsActualHeatRates
            });
        }
Пример #9
0
 public void RemoveCoal(Coal coal)
 {
     if (!coalList.Contains(coal))
     {
         return;
     }
     coalList.Remove(coal);
     if (isHot)
     {
         coal.Extinguish();
         if (coalList.Count == 0 && flameList.Count == 0)
         {
             isHot = false;
         }
     }
     UpdateValue();
 }
Пример #10
0
        public override void GenerateResources()
        {
            Random rnd = new Random();

            //Si pas de ressource, on regenère de 0
            if (Resources.Count == 0)
            {
                Wood w = new Wood(rnd.Next(0, 10));
                base.Resources.Add(w);

                Stone s = new Stone(rnd.Next(0, 30));
                base.Resources.Add(s);

                Water wa = new Water(rnd.Next(0, 10));
                base.Resources.Add(wa);

                Coal co = new Coal(rnd.Next(0, 30));
                base.Resources.Add(co);

                Copper cop = new Copper(rnd.Next(0, 30));
                base.Resources.Add(cop);

                Gold go = new Gold(rnd.Next(0, 5));
                base.Resources.Add(go);

                Iron ir = new Iron(rnd.Next(0, 30));
                base.Resources.Add(ir);

                Silver si = new Silver(rnd.Next(0, 10));
                base.Resources.Add(si);
            }
            else
            {
                foreach (Resource r in Resources)
                {
                    r.Quantity += r.Quantity / 2;
                }
            }
        }
Пример #11
0
    private void SpawnCoal()
    {
        Coal coal = DataBaseManager.Instance.dataBase.coal;

        if (coal == null)
        {
            Debug.LogError("Missing Coal Reference");
        }
        else
        {
            Coal newCoal = Instantiate(coal);
            // Spawn fixe
            newCoal.transform.position = _spawnCoal.transform.position;

            // Spawn aléatoire dans une zone prédéfinie
            //_randomSpawnCoal = Random.insideUnitSphere;
            //_randomSpawnCoal.y = 0;
            //_newSpawnCoal = _spawnCoal.transform.position + _randomSpawnCoal;
            //newCoal.transform.position = _newSpawnCoal;

            newCoal.SpawnerManager = this;
        }
    }
Пример #12
0
        public static GameObject BuildGameObject(XmlElement element)
        {
            string type = element.GetAttribute("type");

            switch (type)
            {
            case "money": return(Money.Build(element));

            case "wood": return(Wood.Build(element));

            case "weapon": return(Weapon.Build(element));

            case "coal": return(Coal.Build(element));

            case "copper": return(Copper.Build(element));

            case "gold": return(Gold.Build(element));

            case "iron": return(Iron.Build(element));

            case "silver": return(Silver.Build(element));

            case "leather": return(Leather.Build(element));

            case "meat": return(Meat.Build(element));

            case "sand": return(Sand.Build(element));

            case "stone": return(Stone.Build(element));

            case "water": return(Water.Build(element));

            case "wheat": return(Wheat.Build(element));

            default: return(null);
            }
        }
Пример #13
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Player")
        {
            //check for each item available and add.
            //itemtype references the item array found under the inventoryScript
            //gameobject.
            //check if full so we can add the items
            if (InventoryScript.MyInstance.MyEmptySlotCount > 0)
            {
                if (itemType == "Leaflet")
                {
                    Leaflet leaflet = (Leaflet)Instantiate(InventoryScript.MyInstance.items[1]);
                    InventoryScript.MyInstance.AddItem(leaflet);
                }
                else if (itemType == "Egg")
                {
                    Egg egg = (Egg)Instantiate(InventoryScript.MyInstance.items[2]);
                    InventoryScript.MyInstance.AddItem(egg);
                }
                else if (itemType == "Sword")
                {
                    Sword sword = (Sword)Instantiate(InventoryScript.MyInstance.items[3]);
                    InventoryScript.MyInstance.AddItem(sword);
                }
                else if (itemType == "Trident")
                {
                    Trident trident = (Trident)Instantiate(InventoryScript.MyInstance.items[4]);
                    InventoryScript.MyInstance.AddItem(trident);
                }
                else if (itemType == "Airpump")
                {
                    AirPump ap = (AirPump)Instantiate(InventoryScript.MyInstance.items[5]);
                    InventoryScript.MyInstance.AddItem(ap);
                }
                else if (itemType == "Bar")
                {
                    PlatinumBar bar = (PlatinumBar)Instantiate(InventoryScript.MyInstance.items[6]);
                    InventoryScript.MyInstance.AddItem(bar);
                }
                else if (itemType == "Knife")
                {
                    Knife knife = (Knife)Instantiate(InventoryScript.MyInstance.items[7]);
                    InventoryScript.MyInstance.AddItem(knife);
                }
                else if (itemType == "Rope")
                {
                    Rope rope = (Rope)Instantiate(InventoryScript.MyInstance.items[8]);
                    InventoryScript.MyInstance.AddItem(rope);
                }
                else if (itemType == "Skull")
                {
                    Skull skull = (Skull)Instantiate(InventoryScript.MyInstance.items[9]);
                    InventoryScript.MyInstance.AddItem(skull);
                }
                else if (itemType == "Sack")
                {
                    Sack sack = (Sack)Instantiate(InventoryScript.MyInstance.items[10]);
                    InventoryScript.MyInstance.AddItem(sack);
                }
                else if (itemType == "Lantern")
                {
                    Lantern lantern = (Lantern)Instantiate(InventoryScript.MyInstance.items[11]);
                    InventoryScript.MyInstance.AddItem(lantern);
                }
                else if (itemType == "Bottle")
                {
                    Bottle bottle = (Bottle)Instantiate(InventoryScript.MyInstance.items[12]);
                    InventoryScript.MyInstance.AddItem(bottle);
                }
                else if (itemType == "Candle")
                {
                    Candle candle = (Candle)Instantiate(InventoryScript.MyInstance.items[13]);
                    InventoryScript.MyInstance.AddItem(candle);
                }
                else if (itemType == "BlackBook")
                {
                    BlkBook book = (BlkBook)Instantiate(InventoryScript.MyInstance.items[14]);
                    InventoryScript.MyInstance.AddItem(book);
                }
                else if (itemType == "PlasticPile")
                {
                    PlasticPile plastic = (PlasticPile)Instantiate(InventoryScript.MyInstance.items[15]);
                    InventoryScript.MyInstance.AddItem(plastic);
                }
                else if (itemType == "Buoy")
                {
                    Buoy buoy = (Buoy)Instantiate(InventoryScript.MyInstance.items[16]);
                    InventoryScript.MyInstance.AddItem(buoy);
                }
                else if (itemType == "Shovel")
                {
                    Shovel shovel = (Shovel)Instantiate(InventoryScript.MyInstance.items[17]);
                    InventoryScript.MyInstance.AddItem(shovel);
                }
                else if (itemType == "Scarab")
                {
                    Scarab scarab = (Scarab)Instantiate(InventoryScript.MyInstance.items[18]);
                    InventoryScript.MyInstance.AddItem(scarab);
                }
                else if (itemType == "PotOfGold")
                {
                    PotOfGold gold = (PotOfGold)Instantiate(InventoryScript.MyInstance.items[19]);
                    InventoryScript.MyInstance.AddItem(gold);
                }
                else if (itemType == "Bracelet")
                {
                    Bracelet bracelet = (Bracelet)Instantiate(InventoryScript.MyInstance.items[20]);
                    InventoryScript.MyInstance.AddItem(bracelet);
                }
                else if (itemType == "Coal")
                {
                    Coal coal = (Coal)Instantiate(InventoryScript.MyInstance.items[21]);
                    InventoryScript.MyInstance.AddItem(coal);
                }
                else if (itemType == "Figurine")
                {
                    Figurine fig = (Figurine)Instantiate(InventoryScript.MyInstance.items[22]);
                    InventoryScript.MyInstance.AddItem(fig);
                }
                else if (itemType == "Diamond")
                {
                    Diamond diamond = (Diamond)Instantiate(InventoryScript.MyInstance.items[23]);
                    InventoryScript.MyInstance.AddItem(diamond);
                }
                else if (itemType == "Torch")
                {
                    Torch torch = (Torch)Instantiate(InventoryScript.MyInstance.items[24]);
                    InventoryScript.MyInstance.AddItem(torch);
                }
                else if (itemType == "Coins")
                {
                    Coins coins = (Coins)Instantiate(InventoryScript.MyInstance.items[25]);
                    InventoryScript.MyInstance.AddItem(coins);
                }
                else if (itemType == "Key")
                {
                    Key key = (Key)Instantiate(InventoryScript.MyInstance.items[26]);
                    InventoryScript.MyInstance.AddItem(key);
                }
                else if (itemType == "Matches")
                {
                    Matches matches = (Matches)Instantiate(InventoryScript.MyInstance.items[27]);
                    InventoryScript.MyInstance.AddItem(matches);
                }
                else if (itemType == "Wrench")
                {
                    Wrench wrench = (Wrench)Instantiate(InventoryScript.MyInstance.items[28]);
                    InventoryScript.MyInstance.AddItem(wrench);
                }
                else if (itemType == "Screwdriver")
                {
                    Screwdriver sd = (Screwdriver)Instantiate(InventoryScript.MyInstance.items[29]);
                    InventoryScript.MyInstance.AddItem(sd);
                }
                else if (itemType == "Jewels")
                {
                    Jewels jewels = (Jewels)Instantiate(InventoryScript.MyInstance.items[30]);
                    InventoryScript.MyInstance.AddItem(jewels);
                }
                else if (itemType == "Coffin")
                {
                    Coffin coffin = (Coffin)Instantiate(InventoryScript.MyInstance.items[31]);
                    InventoryScript.MyInstance.AddItem(coffin);
                }
                else if (itemType == "Chalice")
                {
                    Chalice chalice = (Chalice)Instantiate(InventoryScript.MyInstance.items[32]);
                    InventoryScript.MyInstance.AddItem(chalice);
                }
                //the following items should not be displayed in the world
                //but going to add just in case we revamp how these items
                //are obtained.
                else if(itemType == "Garlic")
                {
                    Garlic garlic = (Garlic)Instantiate(InventoryScript.MyInstance.items[33]);
                    InventoryScript.MyInstance.AddItem(garlic);
                }
                else if(itemType == "Sceptre")
                {
                    Sceptre sep = (Sceptre)Instantiate(InventoryScript.MyInstance.items[34]);
                    InventoryScript.MyInstance.AddItem(sep);
                }






                
                Destroy(gameObject);
            }
            //probably want to utilize CLI popup here
            else
            {
                Debug.Log("Bag full");
            }
        }
        
    }
Пример #14
0
        //by木材追加 長谷川修一 10/27
        /// <summary>
        /// ギミック設置
        /// </summary>
        /// <param name="mapdata">マップデータの二元配列</param>
        /// <param name="MapThings">マップ上の物のList</param>
        public static void CreateGimmicks(int[,] mapdata, List <GameObject> MapThings)
        {
            for (int i = 0; i < mapdata.GetLength(0); i++)
            {
                for (int j = 0; j < mapdata.GetLength(1); j++)
                {
                    switch (mapdata[i, j])
                    {
                    case (int)GimmickType.ICE:
                    {
                        Ice ice = new Ice(new Vector2(j * 64, i * 64), Vector2.Zero);
                        MapThings.Add(ice);
                        break;
                    }

                    case (int)GimmickType.IRON:
                    {
                        Iron iron = new Iron(new Vector2(j * 64, i * 64), Vector2.Zero);
                        MapThings.Add(iron);
                        break;
                    }

                    case (int)GimmickType.LIGHT:
                    {
                        Light light = new Light(new Vector2(j * 64, i * 64));
                        MapThings.Add(light);
                        break;
                    }

                    case (int)GimmickType.STRAW:
                    {
                        Straw straw = new Straw(new Vector2(j * 64, i * 64));
                        MapThings.Add(straw);
                        break;
                    }

                    case (int)GimmickType.COAL:
                    {
                        Coal coal = new Coal(new Vector2(j * 64, i * 64), Vector2.Zero);
                        MapThings.Add(coal);
                        break;
                    }

                    case (int)GimmickType.GOAL:
                    {
                        Goal goal = new Goal(new Vector2(j * 64, i * 64));
                        MapThings.Add(goal);
                        break;
                    }

                    case (int)GimmickType.WATER:
                    {
                        Water water = new Water(new Vector2(j * 64, i * 64), Vector2.Zero);
                        MapThings.Add(water);
                        break;
                    }

                    case (int)GimmickType.WOOD:
                    {
                        Wood wood = new Wood(new Vector2(j * 64, i * 64));
                        MapThings.Add(wood);
                        break;
                    }

                    case (int)GimmickType.TREE:
                    {
                        Tree tree = new Tree(new Vector2(j * 64, i * 64));
                        MapThings.Add(tree);
                        break;
                    }

                    case (int)GimmickType.SAND:
                    {
                        Sand sand = new Sand(new Vector2(j * 64, i * 64), Vector2.Zero);
                        MapThings.Add(sand);
                        break;
                    }

                    case (int)GimmickType.BALLOON:
                    {
                        Balloon balloon = new Balloon(new Vector2(j * 64, i * 64), Vector2.Zero);
                        MapThings.Add(balloon);
                        break;
                    }
                    }
                }
            }
        }
Пример #15
0
        public override bool Give( Mobile m, Item item, bool placeAtFeet )
        {
            PlayerMobile pm = m as PlayerMobile;

            if( m is PlayerMobile )
            {
                pm.Crafting = true;
                LevelSystem.AwardMinimumXP( pm, 1 );
                pm.Crafting = false;
                Item controller = null;
                CopperOre ore = new CopperOre();

                if( pm.UniqueSpot != null )
                {
                    if( World.FindItem( pm.UniqueSpot.Serial ) != null )
                    {
                        controller = World.FindItem( pm.UniqueSpot.Serial );

                        if( controller is ResourceController && pm.InRange( controller, ( (ResourceController)controller ).Range ) )
                        {
                            ResourceController rescontroller = controller as ResourceController;
                            double chance = 0;

                            switch( rescontroller.Intensity )
                            {
                                case VeinIntensity.Low: chance = 4; break;
                                case VeinIntensity.Average: chance = 6; break;
                                case VeinIntensity.Full: chance = 8; break;
                            }

                            if( chance >= Utility.RandomMinMax( 1, 100 ) )
                            {
                                if( m.AccessLevel > AccessLevel.Player )
                                    m.SendMessage( "Debug message: resource controller activated." );

                                switch( rescontroller.ControlledResource )
                                {
                                    case ControlledResource.Copper: item = ore; break;

                                    case ControlledResource.Tin:
                                    {
                                        TinOre newore = new TinOre();
                                        item = newore;
                                        break;
                                    }

                                    case ControlledResource.Iron:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 80 )
                                        {
                                            IronOre newore = new IronOre();
                                            item = newore;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Obsidian:
                                    {
                                        ObsidianIngot newore = new ObsidianIngot();
                                        item = newore;
                                        item.Amount = 5;
                                        break;
                                    }

                                    case ControlledResource.Silver:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 85 )
                                        {
                                            SilverOre newore = new SilverOre();
                                            item = newore;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Gold:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 95 )
                                        {
                                            GoldOre newore = new GoldOre();
                                            item = newore;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Citrine:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 80 )
                                        {
                                            Citrine gem = new Citrine();
                                            item = gem;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Tourmaline:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 80 )
                                        {
                                            Tourmaline gem = new Tourmaline();
                                            item = gem;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Amethyst:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 90 )
                                        {
                                            Amethyst gem = new Amethyst();
                                            item = gem;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Emerald:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 90 )
                                        {
                                            Emerald gem = new Emerald();
                                            item = gem;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Ruby:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 90 )
                                        {
                                            Ruby gem = new Ruby();
                                            item = gem;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Sapphire:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 85 )
                                        {
                                            Sapphire gem = new Sapphire();
                                            item = gem;
                                        }
                                        break;
                                    }

                                    case ControlledResource.StarSapphire:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 95 )
                                        {
                                            StarSapphire gem = new StarSapphire();
                                            item = gem;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Diamond:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 95 )
                                        {
                                            Diamond gem = new Diamond();
                                            item = gem;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Coal:
                                    {
                                        if( pm.Feats.GetFeatLevel( FeatList.Sculptor ) > 0 )
                                        {
                                            Coal coal = new Coal();
                                            item = coal;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Cinnabar:
                                    {
                                        if (pm.Feats.GetFeatLevel(FeatList.GemHarvesting) > 2)
                                        {
                                            Cinnabar cinnabar = new Cinnabar();
                                            item = cinnabar;
                                        }
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }

                if( item is Citrine || item is Tourmaline || item is Amethyst )
                {
                    if( pm.Feats.GetFeatLevel(FeatList.GemHarvesting) < 1 || !pm.GemHarvesting)
                        item = ore;
                }

                else if( item is Emerald || item is Ruby || item is Sapphire )
                {
                    if( pm.Feats.GetFeatLevel(FeatList.GemHarvesting) < 2 )
                        item = ore;

                    if( !pm.GemHarvesting )
                    {
                        TinOre tin = new TinOre();
                        item = tin;
                    }
                }

                else if( item is StarSapphire || item is Diamond || item is Cinnabar)
                {
                    if( pm.Feats.GetFeatLevel(FeatList.GemHarvesting) < 3 )
                        item = ore;

                    if( !pm.GemHarvesting )
                    {
                        IronOre iron = new IronOre();
                        item = iron;
                    }
                }

                else if( item is ObsidianIngot && pm.Feats.GetFeatLevel(FeatList.Obsidian) < 1 )
                    item = ore;
            }

            if( m is PlayerMobile && pm.Feats.GetFeatLevel(FeatList.GemHarvesting) > 0 && pm.GemHarvesting && item is CopperOre && Utility.RandomMinMax( 1, 100 ) > 95 )
            {
                int roll = Utility.RandomMinMax( 1, 100 );
                if (roll > 95 && pm.Feats.GetFeatLevel(FeatList.GemHarvesting) > 2)
                    item = new Cinnabar();
                if( roll > 90 && pm.Feats.GetFeatLevel(FeatList.GemHarvesting) > 2)
                    item = new Diamond();
                else if( roll > 80 && pm.Feats.GetFeatLevel(FeatList.GemHarvesting) > 2 )
                    item = new StarSapphire();
                else if( roll > 70 && pm.Feats.GetFeatLevel(FeatList.GemHarvesting) > 1 )
                    item = new Ruby();
                else if( roll > 59 && pm.Feats.GetFeatLevel(FeatList.GemHarvesting) > 1 )
                    item = new Emerald();
                else if( roll > 48 && pm.Feats.GetFeatLevel(FeatList.GemHarvesting) > 1 )
                    item = new Sapphire();
                else if( roll > 37 )
                    item = new Amethyst();
                else if( roll > 20 )
                    item = new Tourmaline();
                else
                    item = new Citrine();
            }

            string orename = "some copper ore";

            if( item is TinOre )
                orename = "some tin ore";

            else if( item is IronOre )
                orename = "some iron ore";

            else if( item is ObsidianIngot )
                orename = "some obsidian";

            else if( item is SilverOre )
                orename = "some silver ore";

            else if( item is GoldOre )
                orename = "some gold ore";

            else if( item is Citrine )
                orename = "a citrine";

            else if( item is Tourmaline )
                orename = "a tourmaline";

            else if( item is Emerald )
                orename = "an emerald";

            else if( item is Amethyst )
                orename = "an amethyst";

            else if( item is Ruby )
                orename = "a ruby";

            else if( item is Sapphire )
                orename = "a sapphire";

            else if( item is StarSapphire )
                orename = "a star sapphire";

            else if( item is Diamond )
                orename = "a diamond";

            else if( item is Sand )
                orename = "some sand";

            else if( item is Coal )
                orename = "some coal";

            m.SendMessage( "You dig " + orename + " and put it in your backpack." );

            if ( m.PlaceInBackpack( item ) )
                return true;

            if ( !placeAtFeet )
                return false;

            Map map = m.Map;

            if ( map == null )
                return false;

            ArrayList atFeet = new ArrayList();

            foreach ( Item obj in m.GetItemsInRange( 0 ) )
                atFeet.Add( obj );

            for ( int i = 0; i < atFeet.Count; ++i )
            {
                Item check = (Item)atFeet[i];

                if ( check.StackWith( m, item, false ) )
                    return true;
            }

            item.MoveToWorld( m.Location, map );
            return true;
        }
Пример #16
0
        /// <summary>
        /// ギミック設置
        /// by柏 SE実装 2016.12.14
        /// </summary>
        /// <param name="mapdata">マップデータの二元配列</param>
        /// <param name="MapThings">マップ上の物のList</param>
        public static void CreateGimmicks(int[,] mapdata, List <GameObject> MapThings, Sound sound)
        {
            for (int i = 0; i < mapdata.GetLength(0); i++)
            {
                for (int j = 0; j < mapdata.GetLength(1); j++)
                {
                    switch (mapdata[i, j])
                    {
                    case (int)GimmickType.ICE:
                    {
                        Ice ice = new Ice(new Vector2(j * 64, i * 64), Vector2.Zero);
                        MapThings.Add(ice);
                        break;
                    }

                    case (int)GimmickType.IRON:
                    {
                        Iron iron = new Iron(new Vector2(j * 64, i * 64), Vector2.Zero);
                        MapThings.Add(iron);
                        break;
                    }

                    case (int)GimmickType.LIGHT:
                    {
                        Light light = new Light(new Vector2(j * 64, i * 64));
                        MapThings.Add(light);
                        break;
                    }

                    case (int)GimmickType.STRAW:
                    {
                        Straw straw = new Straw(new Vector2(j * 64, i * 64));
                        MapThings.Add(straw);
                        break;
                    }

                    case (int)GimmickType.COAL:
                    {
                        Coal coal = new Coal(new Vector2(j * 64, i * 64), Vector2.Zero);
                        MapThings.Add(coal);
                        break;
                    }

                    case (int)GimmickType.GOAL:
                    {
                        Goal goal = new Goal(new Vector2(j * 64, i * 64), sound);
                        MapThings.Add(goal);
                        break;
                    }

                    case (int)GimmickType.WATER:
                    {
                        Water water = new Water(new Vector2(j * 64, i * 64), Vector2.Zero);
                        MapThings.Add(water);
                        break;
                    }

                    case (int)GimmickType.WOOD:
                    {
                        Wood wood = new Wood(new Vector2(j * 64, i * 64));
                        MapThings.Add(wood);
                        break;
                    }

                    case (int)GimmickType.TREE:
                    {
                        Tree tree = new Tree(new Vector2(j * 64, i * 64));
                        MapThings.Add(tree);
                        break;
                    }

                    case (int)GimmickType.SAND:
                    {
                        Sand sand = new Sand(new Vector2(j * 64, i * 64), Vector2.Zero);
                        MapThings.Add(sand);
                        break;
                    }

                    case (int)GimmickType.BALLOON:
                    {
                        Balloon balloon = new Balloon(new Vector2(j * 64, i * 64), Vector2.Zero);
                        MapThings.Add(balloon);
                        break;
                    }

                    //葉梨竜太
                    case (int)GimmickType.HIGHLIGHT3:
                    {
                        MoveLight moveLight = new MoveLight(new Vector2(j * 64, i * 64), new Vector2(j * 64, (i + 3) * 64), Parameter.MoveLightSpeed);
                        MapThings.Add(moveLight);
                        break;
                    }

                    case (int)GimmickType.SIDELIGHT3:
                    {
                        MoveLight moveLight = new MoveLight(new Vector2(j * 64, i * 64), new Vector2((j + 3) * 64, i * 64), Parameter.MoveLightSpeed);
                        MapThings.Add(moveLight);
                        break;
                    }

                    case (int)GimmickType.HIGHLIGHT5:
                    {
                        MoveLight moveLight = new MoveLight(new Vector2(j * 64, i * 64), new Vector2(j * 64, (i + 5) * 64), Parameter.MoveLightSpeed);
                        MapThings.Add(moveLight);
                        break;
                    }

                    case (int)GimmickType.SIDELIGHT5:
                    {
                        MoveLight moveLight = new MoveLight(new Vector2(j * 64, i * 64), new Vector2((j + 5) * 64, i * 64), Parameter.MoveLightSpeed);
                        MapThings.Add(moveLight);
                        break;
                    }

                    case (int)GimmickType.JSIGN:
                    {
                        Sign sign = new Sign(new Vector2(j * 64, i * 64), (int)GimmickType.JSIGN);
                        MapThings.Add(sign);
                        break;
                    }

                    //葉梨竜太 11/30
                    case (int)GimmickType.BOMB:
                    {
                        Bomb bomb = new Bomb(new Vector2(j * 64, i * 64), sound, Vector2.Zero);
                        MapThings.Add(bomb);
                        break;
                    }

                    //葉梨竜太
                    case (int)GimmickType.IGNITER_UR:
                    {
                        Igniter igniter = new Igniter(new Vector2(j * 64, i * 64), (int)GimmickType.IGNITER_UR);
                        MapThings.Add(igniter);
                        break;
                    }

                    case (int)GimmickType.IGNITER_UL:
                    {
                        Igniter igniter = new Igniter(new Vector2(j * 64, i * 64), (int)GimmickType.IGNITER_UL);
                        MapThings.Add(igniter);
                        break;
                    }

                    case (int)GimmickType.IGNITER_DR:
                    {
                        Igniter igniter = new Igniter(new Vector2(j * 64, i * 64), (int)GimmickType.IGNITER_DR);
                        MapThings.Add(igniter);
                        break;
                    }

                    case (int)GimmickType.IGNITER_DL:
                    {
                        Igniter igniter = new Igniter(new Vector2(j * 64, i * 64), (int)GimmickType.IGNITER_DL);
                        MapThings.Add(igniter);
                        break;
                    }

                    case (int)GimmickType.IGNITER_HIGHT:
                    {
                        Igniter igniter = new Igniter(new Vector2(j * 64, i * 64), (int)GimmickType.IGNITER_HIGHT);
                        MapThings.Add(igniter);
                        break;
                    }

                    case (int)GimmickType.IGNITER_SIDE:
                    {
                        Igniter igniter = new Igniter(new Vector2(j * 64, i * 64), (int)GimmickType.IGNITER_SIDE);
                        MapThings.Add(igniter);
                        break;
                    }

                    //葉梨竜太
                    case (int)GimmickType.MSIGN:
                    {
                        Sign sign = new Sign(new Vector2(j * 64, i * 64), (int)GimmickType.MSIGN);
                        MapThings.Add(sign);
                        break;
                    }

                    case (int)GimmickType.RSIGN:
                    {
                        Sign sign = new Sign(new Vector2(j * 64, i * 64), (int)GimmickType.RSIGN);
                        MapThings.Add(sign);
                        break;
                    }

                    case (int)GimmickType.LSIGN:
                    {
                        Sign sign = new Sign(new Vector2(j * 64, i * 64), (int)GimmickType.LSIGN);
                        MapThings.Add(sign);
                        break;
                    }

                    case (int)GimmickType.CSIGN:
                    {
                        Sign sign = new Sign(new Vector2(j * 64, i * 64), (int)GimmickType.CSIGN);
                        MapThings.Add(sign);
                        break;
                    }

                    // 1/13 葉梨竜太
                    case (int)GimmickType.ROCK:
                    {
                        Stone stone = new Stone(new Vector2(j * 64, i * 64));
                        MapThings.Add(stone);
                        break;
                    }
                    }
                }
            }
        }
Пример #17
0
        public static InventoryItem CreateInventoryItem(string key, TeamType team, string region, Vector2 location, ContentManager content, GraphicsDevice graphics)
        {
            InventoryItem item          = null;
            int           amountStacked = 1;

            switch (key)
            {
            case ("tribalTokens"):
                item = new TribalTokens(team, region, location, content, graphics);
                break;

            case ("basePlank"):
                item = new BasePlank(team, region, location, content, graphics);
                break;

            case ("shortSword"):
                item = new ShortSword(team, region, location, content, graphics);
                break;

            case ("softWood"):
                item = new SoftWood(team, region, location, content, graphics);
                break;

            case ("islandGrass"):
                item = new IslandGrass(team, region, location, content, graphics);
                break;

            case ("coal"):
                item = new Coal(team, region, location, content, graphics);
                break;

            case ("ironOre"):
                item = new IronOre(team, region, location, content, graphics);
                break;

            case ("baseSword"):
                item = new BaseSword(team, region, location, content, graphics);
                break;

            case ("anvilItem"):
                item = new AnvilItem(team, region, location, content, graphics);
                item.placeableVersion = new CraftingAnvil(team, region, location, content, graphics);
                break;

            case ("baseChestItem"):
                item = new BaseChestItem(team, region, location, content, graphics);
                item.placeableVersion = new BaseChest(team, region, location, content, graphics);
                break;

            case ("nails"):
                item          = new Nails(team, region, location, content, graphics);
                amountStacked = 5;
                break;

            case ("cannonBallItem"):
                item          = new CannonBallItem(team, region, location, content, graphics);
                amountStacked = 3;
                break;

            case ("pistolShotItem"):
                item          = new PistolShotItem(team, region, location, content, graphics);
                amountStacked = 5;
                break;

            case ("ironBar"):
                item = new IronBar(team, region, location, content, graphics);
                break;

            case ("treasureMapItem"):
                item = new TreasureMapItem(null, team, region, location, content, graphics);
                break;

            case ("chiliFish"):
                item = new ChiliFish(team, region, location, content, graphics);
                break;

            case ("chiliPepper"):
                item = new ChiliPepper(team, region, location, content, graphics);
                break;

            case ("cookedFish"):
                item = new CookedFish(team, region, location, content, graphics);
                break;

            case ("cookedMeat"):
                item = new CookedMeat(team, region, location, content, graphics);
                break;

            case ("rawFish"):
                item = new RawFish(team, region, location, content, graphics);
                break;

            case ("rawMeat"):
                item = new RawMeat(team, region, location, content, graphics);
                break;

            case ("spoiledFish"):
                item = new SpoiledFish(team, region, location, content, graphics);
                break;

            case ("spoiledMeat"):
                item = new SpoiledMeat(team, region, location, content, graphics);
                break;

            case ("feather"):
                item = new Feather(team, region, location, content, graphics);
                break;

            case ("scales"):
                item = new Scales(team, region, location, content, graphics);
                break;

            case ("fishOil"):
                item = new FishOil(team, region, location, content, graphics);
                break;

            case ("goldCoins"):
                item = new GoldCoins(team, region, location, content, graphics);
                break;
            }
            item.itemKey       = key;
            item.amountStacked = amountStacked;
            return(item);
        }