コード例 #1
0
 public SpawnBehaviorArea(MyRectangle area)
 {
     Area = area;
 }
コード例 #2
0
        public static FarmBehavior getFarmBehaviorFromPreset(int vanillaId)
        {
            MyRectangle mapRect = new MyRectangle(0, 0, 80, 65);

            FarmBehavior b = new FarmBehavior();

            switch (vanillaId)
            {
            case Farm.default_layout:
                break;

            case Farm.riverlands_layout:
            {
                b.FishingSplashChance = 0.5;
                b.FishPoolToDrawFrom  = new List <FarmBehavior.FishPoolDrawEntry>();
                b.FishPoolToDrawFrom.Add(new FarmBehavior.FishPoolDrawEntry(mapRect, 0, 1));
                var fish = new List <FarmBehavior.FishPoolEntry>();
                fish.Add(FarmBehavior.FishPoolEntry.Preset(0.3, "Forest"));
                fish.Add(FarmBehavior.FishPoolEntry.FinalPreset("Town"));
                b.FishPools = new List <List <FarmBehavior.FishPoolEntry> >();
                b.FishPools.Add(fish);
            }
            break;

            case Farm.forest_layout:
            {
                b.FishPoolToDrawFrom = new List <FarmBehavior.FishPoolDrawEntry>();
                b.FishPoolToDrawFrom.Add(new FarmBehavior.FishPoolDrawEntry(mapRect, 0, 1));
                var fish = new List <FarmBehavior.FishPoolEntry>();
                fish.Add(FarmBehavior.FishPoolEntry.Object(0.5, 734, 1.0));
                fish.Add(FarmBehavior.FishPoolEntry.Preset(0.5, "Forest"));
                b.FishPools = new List <List <FarmBehavior.FishPoolEntry> >();
                b.FishPools.Add(fish);

                b.RepopulateStumps = true;
                b.SpecialWeedCount = 6;

                b.ForageableSpawnChanceBase       = 0.75;
                b.ForageableSpawnChanceMultiplier = 1.0;
                b.ForageableSpawnBehavior         = new Dictionary <string, List <FarmBehavior.SpawnBehaviorArea> >();

                var spring = new FarmBehavior.SpawnBehaviorArea(mapRect);
                spring.Entries.Add(FarmBehavior.SpawnBehaviorEntry.Forageable(0.25, 16));
                spring.Entries.Add(FarmBehavior.SpawnBehaviorEntry.Forageable(0.25, 22));
                spring.Entries.Add(FarmBehavior.SpawnBehaviorEntry.Forageable(0.25, 20));
                spring.Entries.Add(FarmBehavior.SpawnBehaviorEntry.Forageable(0.00, 257));         // The last one is always chosen if none of the others are. No need to give it an extra 25% chance as well.
                var springAreas = new List <FarmBehavior.SpawnBehaviorArea>();
                springAreas.Add(spring);
                b.ForageableSpawnBehavior.Add("spring", springAreas);

                var summer = new FarmBehavior.SpawnBehaviorArea(mapRect);
                summer.Entries.Add(FarmBehavior.SpawnBehaviorEntry.Forageable(0.25, 402));
                summer.Entries.Add(FarmBehavior.SpawnBehaviorEntry.Forageable(0.25, 396));
                summer.Entries.Add(FarmBehavior.SpawnBehaviorEntry.Forageable(0.25, 398));
                summer.Entries.Add(FarmBehavior.SpawnBehaviorEntry.Forageable(0.00, 404));
                var summerAreas = new List <FarmBehavior.SpawnBehaviorArea>();
                summerAreas.Add(summer);
                b.ForageableSpawnBehavior.Add("summer", summerAreas);

                var fall = new FarmBehavior.SpawnBehaviorArea(mapRect);
                fall.Entries.Add(FarmBehavior.SpawnBehaviorEntry.Forageable(0.25, 281));
                fall.Entries.Add(FarmBehavior.SpawnBehaviorEntry.Forageable(0.25, 420));
                fall.Entries.Add(FarmBehavior.SpawnBehaviorEntry.Forageable(0.25, 422));
                fall.Entries.Add(FarmBehavior.SpawnBehaviorEntry.Forageable(0.00, 404));
                var fallAreas = new List <FarmBehavior.SpawnBehaviorArea>();
                fallAreas.Add(fall);
                b.ForageableSpawnBehavior.Add("fall", fallAreas);
            }
            break;

            case Farm.mountains_layout:
            {
                b.FishPoolToDrawFrom = new List <FarmBehavior.FishPoolDrawEntry>();
                b.FishPoolToDrawFrom.Add(new FarmBehavior.FishPoolDrawEntry(mapRect, 0, 1));
                var fish = new List <FarmBehavior.FishPoolEntry>();
                fish.Add(FarmBehavior.FishPoolEntry.Preset(0.5, "Forest"));
                b.FishPools = new List <List <FarmBehavior.FishPoolEntry> >();
                b.FishPools.Add(fish);

                b.OreSpawnChanceBase       = 1;
                b.OreSpawnChanceMultiplier = 0.66;
                b.NewSaveOreGenRuns        = 28;

                var chances     = new FarmBehavior.SpawnBehaviorArea(new MyRectangle(5, 37, 22, 8));
                var firstChance = FarmBehavior.SpawnBehaviorEntry.Ore(.15, -1, 590, 0);
                firstChance.SkipChanceDecrease = true;
                firstChance.InitialStack       = 1;
                chances.Entries.Add(firstChance);
                chances.Entries.Add(FarmBehavior.SpawnBehaviorEntry.Ore(.5, -1, 670, 0));
                var multiChance = new FarmBehavior.SpawnBehaviorEntry();
                multiChance.Chance     = .1;
                multiChance.SubEntries = new List <FarmBehavior.SpawnBehaviorEntry>();
                multiChance.SubEntries.Add(FarmBehavior.SpawnBehaviorEntry.Ore(.33, 8, 77, 7));
                multiChance.SubEntries.Add(FarmBehavior.SpawnBehaviorEntry.Ore(.5, 5, 76, 5));
                multiChance.SubEntries.Add(FarmBehavior.SpawnBehaviorEntry.Ore(1, -1, 75, 3));
                chances.Entries.Add(multiChance);
                chances.Entries.Add(FarmBehavior.SpawnBehaviorEntry.Ore(.21, -1, 751, 3));
                chances.Entries.Add(FarmBehavior.SpawnBehaviorEntry.Ore(.15, 4, 290, 4));
                chances.Entries.Add(FarmBehavior.SpawnBehaviorEntry.Ore(.1, 7, 764, 8));
                chances.Entries.Add(FarmBehavior.SpawnBehaviorEntry.Ore(.01, 10, 765, 16));
                chances.Entries.Add(FarmBehavior.SpawnBehaviorEntry.Ore(1.0, -1, 668, 2));

                b.OreSpawnBehavior = new List <FarmBehavior.SpawnBehaviorArea>();
                b.OreSpawnBehavior.Add(chances);
            }
            break;

            case Farm.combat_layout:
            {
                b.FishPoolToDrawFrom = new List <FarmBehavior.FishPoolDrawEntry>();
                b.FishPoolToDrawFrom.Add(new FarmBehavior.FishPoolDrawEntry(mapRect, 0, 0));
                var fish = new List <FarmBehavior.FishPoolEntry>();
                fish.Add(FarmBehavior.FishPoolEntry.Preset(0.35, "Mountain"));
                b.FishPools = new List <List <FarmBehavior.FishPoolEntry> >();
                b.FishPools.Add(fish);

                b.SpawnMonsters = true;
            }
            break;
            }

            return(b);
        }
コード例 #3
0
 public FishPoolDrawEntry(MyRectangle area, int id, int list)
 {
     Area               = area;
     PoolId             = id;
     ListFromLocationID = list;
 }