Ejemplo n.º 1
0
        /// <summary>
        /// Create a new weighted collection based on given weighted collection of ASCII glyphs, where each glyph
        /// is present in any of the colors in the palette.
        /// </summary>
        /// <remarks>
        /// This method adjusts the weights in order to make each symbol equally as likely as before
        /// </remarks>
        private static WeightedCollection <Tile> WithPalette(
            WeightedCollection <int> glyphs,
            IEnumerable <Color> palette)
        {
            var collection  = new WeightedCollection <Tile>();
            var paletteSize = palette.Count();

            foreach (var entry in glyphs)
            {
                var weight = entry.Weight / (float)paletteSize;

                foreach (var color in palette)
                {
                    collection.Add(weight, new Tile(entry.Value, color, DefaultColors.Black));
                }
            }

            return(collection);
        }
Ejemplo n.º 2
0
 static void Main(string[] args) {
     weightedCollection = new WeightedCollection<string>();
     while(true) {
         try {
             Console.WriteLine();
             Console.Write(">> ");
             string cmd = Console.ReadLine();
             var cmdSplitted = cmd.Split(' ');
             if(cmdSplitted.Length < 1) continue;
             switch(cmdSplitted[0].ToLower()) {
                 case "add": Add(cmdSplitted); break;
                 case "remove": Remove(cmdSplitted); break;
                 case "cls": Console.Clear(); break;
                 case "clear": Clear(); break;
                 case "list": List(); break;
                 case "random": Random(cmdSplitted); break;
                 case "help": Help(); break;
                 default: Console.WriteLine("I don't know what should I do with \"{0}\".", cmd); break;
             }
         } catch(Exception ex) {
             Console.WriteLine("Error: {0}", ex.Message);
         }
     }
 }
Ejemplo n.º 3
0
    public static void LoadDefinitions()
    {
        Definitions = new Dictionary <SpellID, Spell>();

        new Spell("Produce Aurum", SpellID.Alchemy, 1, DomainID.Immolian)
        .setEffects(SpellEffect.MakeAurum)
        .setRequiresValidTarget(false)
        .setReward(new Reward().AddAurum(1));

        //Tier 1 Spells - Cost 6

        new Spell("Hag's Remedy", SpellID.HagsRemedy, 1, DomainID.Waeor)
        .setEffects(SpellEffect.GrowHair, SpellEffect.CureWarts)
        .addIngredient(IngredientID.Fang, 1)
        .addIngredient(IngredientID.Parchment, 3);

        new Spell("Seafarer's Charm", SpellID.SeaferersCharm, 1, DomainID.Tempus)
        .setEffects(SpellEffect.PredictWeather, SpellEffect.DiscernValue)
        .addIngredient(IngredientID.Parchment, 1)
        .addIngredient(IngredientID.Salt, 1);

        new Spell("Potion of Aphrodite", SpellID.PotionOfAphrodite, 1, DomainID.Immolian)
        .setEffects(SpellEffect.InspireAffection, SpellEffect.Courage)
        .addIngredient(IngredientID.Ink, 1)
        .addIngredient(IngredientID.Candle, 1);

        new Spell("Mausoleum Ritual", SpellID.MausoleumRitual, 1, DomainID.Penumok)
        .setEffects(SpellEffect.SanctifyCorpse, SpellEffect.SendNightmares)
        .addIngredient(IngredientID.Parchment, 2)
        .addIngredient(IngredientID.Ink, 2);

        new Spell("Confound Mirrors", SpellID.ConfoundMirror, 1, DomainID.Anestra)
        .setEffects(SpellEffect.ProtectDreams, SpellEffect.Irritation)
        .addIngredient(IngredientID.Quartz, 1);

        //IrritationHex, CureWarts, SanctifyCorpse, CreateLuck, InspireLove, AbjureNightmares, KnowWeather, InspireNightmares, GrowHair, KnowValue,
        new Spell("Lionheart Potion", SpellID.LionheartPotion, 1, DomainID.Waeor)
        .setEffects(SpellEffect.Courage)
        .addIngredient(IngredientID.Fang, 1)
        .addIngredient(IngredientID.Ink, 1)
        .addIngredient(IngredientID.Parchment, 1);

        new Spell("Blessing of Worms", SpellID.BlessingOfWorms, 1, DomainID.Waeor)
        .setEffects(SpellEffect.SanctifyCorpse)
        .addIngredient(IngredientID.Fang, 2);

        new Spell("Sleeper's Sun", SpellID.SleepersSun, 1, DomainID.Tempus)
        .setEffects(SpellEffect.ProtectDreams)
        .addIngredient(IngredientID.Salt, 1)
        .addIngredient(IngredientID.Parchment, 1);    //Cheap!

        new Spell("Chains of Loyalty", SpellID.ChainOfLoyalty, 1, DomainID.Tempus)
        .setEffects(SpellEffect.ProtectDreams)
        .addIngredient(IngredientID.Salt, 1)
        .addIngredient(IngredientID.Parchment, 1);

        new Spell("Vision of Inferno", SpellID.VisionsOfInferno, 1, DomainID.Immolian)
        .setEffects(SpellEffect.SendNightmares)
        .addIngredient(IngredientID.Candle, 1)
        .addIngredient(IngredientID.Parchment, 2);

        new Spell("Charlatan's Wig", SpellID.CharlatansWig, 1, DomainID.Immolian)
        .setEffects(SpellEffect.GrowHair)
        .addIngredient(IngredientID.Candle, 1)
        .addIngredient(IngredientID.Parchment, 2);

        new Spell("Slithering Sensation", SpellID.SlitheringSensation, 1, DomainID.Penumok)
        .setEffects(SpellEffect.Irritation)
        .addIngredient(IngredientID.Ink, 3);

        new Spell("Gouge Deformity", SpellID.SeverDeformity, 1, DomainID.Penumok)
        .setEffects(SpellEffect.CureWarts)
        .addIngredient(IngredientID.Parchment, 1)
        .addIngredient(IngredientID.Ink, 1)
        .addIngredient(IngredientID.Fang, 1);

        new Spell("Speak with Birds", SpellID.HeedTheBirds, 1, DomainID.Anestra)
        .setEffects(SpellEffect.PredictWeather)
        .addIngredient(IngredientID.Quartz, 1);

        new Spell("Reveal Worth", SpellID.RevealWorth, 1, DomainID.Anestra)
        .setEffects(SpellEffect.DiscernValue)
        .addIngredient(IngredientID.Parchment, 4)
        .addIngredient(IngredientID.Quartz, 1);



        //Parchment 1, Ink 2, Herb/Fang 3, Worm/Candle 4, Ankh/Salt 5, Diamond 6
        //Tier 2 Spells - Cost 9

        new Spell("Mating Ritual", SpellID.MatingRitual, 2, DomainID.Waeor)
        .setEffects(SpellEffect.CureImpotence, SpellEffect.RevealAdmirer)
        .addIngredient(IngredientID.Parchment, 1)
        .addIngredient(IngredientID.Ink, 1)
        .addIngredient(IngredientID.Fang, 2);

        new Spell("Final Words", SpellID.ImmutableWords, 2, DomainID.Tempus)
        .setEffects(SpellEffect.SanctifyWedding, SpellEffect.Deafen)
        .addIngredient(IngredientID.Parchment, 2)
        .addIngredient(IngredientID.Ink, 1)
        .addIngredient(IngredientID.Salt, 1);

        new Spell("Incense", SpellID.Incense, 2, DomainID.Immolian)
        .setEffects(SpellEffect.InspireHatred, SpellEffect.Embarass)
        .addIngredient(IngredientID.Parchment, 1)
        .addIngredient(IngredientID.Candle, 2);

        new Spell("Mask of Dread", SpellID.MaskOfDread, 2, DomainID.Penumok)
        .setEffects(SpellEffect.BanishGhost, SpellEffect.MakeFearsome)
        .addIngredient(IngredientID.Parchment, 3)
        .addIngredient(IngredientID.Ink, 3);

        new Spell("Stardust", SpellID.Stardust, 2, DomainID.Anestra)
        .setEffects(SpellEffect.KnowEnchantment, SpellEffect.AlterMemory)
        .addIngredient(IngredientID.Parchment, 7)
        .addIngredient(IngredientID.Quartz, 1);


        new Spell("Ravenous Aspect", SpellID.RavenousAspect, 2, DomainID.Waeor)
        .setEffects(SpellEffect.MakeFearsome)
        .addIngredient(IngredientID.Fang, 3);

        new Spell("Hog's Writhing", SpellID.HogsWriting, 2, DomainID.Waeor)
        .setEffects(SpellEffect.Embarass)
        .addIngredient(IngredientID.Fang, 3);

        new Spell("Radiant Reliquary", SpellID.RadiantReliquary, 2, DomainID.Tempus)
        .setEffects(SpellEffect.BanishGhost)
        .addIngredient(IngredientID.Parchment, 2)
        .addIngredient(IngredientID.Ink, 1)
        .addIngredient(IngredientID.Salt, 1);

        new Spell("Song of Rivalry", SpellID.SongOfRivalry, 2, DomainID.Tempus)
        .setEffects(SpellEffect.InspireHatred)
        .addIngredient(IngredientID.Parchment, 2)
        .addIngredient(IngredientID.Ink, 1)
        .addIngredient(IngredientID.Salt, 1);

        new Spell("Rewrite Memories", SpellID.ReviseMemories, 2, DomainID.Immolian)
        .setEffects(SpellEffect.AlterMemory)
        .addIngredient(IngredientID.Parchment, 1)
        .addIngredient(IngredientID.Candle, 2);

        new Spell("Confuse Speach", SpellID.ConfuseSpeach, 2, DomainID.Immolian)
        .setEffects(SpellEffect.Embarass)
        .addIngredient(IngredientID.Parchment, 1)
        .addIngredient(IngredientID.Candle, 2);

        new Spell("Silence of the Grave", SpellID.SilenceOfTheGrave, 2, DomainID.Penumok)
        .setEffects(SpellEffect.Deafen)
        .addIngredient(IngredientID.Parchment, 3)
        .addIngredient(IngredientID.Ink, 3);

        new Spell("Read Runes", SpellID.ReadRunes, 2, DomainID.Penumok)
        .setEffects(SpellEffect.KnowEnchantment)
        .addIngredient(IngredientID.Parchment, 3)
        .addIngredient(IngredientID.Ink, 3);

        new Spell("Watch the Watcher", SpellID.WatchTheWatcher, 2, DomainID.Anestra)
        .setEffects(SpellEffect.RevealAdmirer)
        .addIngredient(IngredientID.Parchment, 4)
        .addIngredient(IngredientID.Quartz, 1);

        new Spell("Winter Ceremony", SpellID.WinterCeremony, 2, DomainID.Anestra)
        .setEffects(SpellEffect.SanctifyWedding)
        .addIngredient(IngredientID.Parchment, 4)
        .addIngredient(IngredientID.Quartz, 1);


        //Parchment 1, Ink 2, Herb/Fang 3, Worm/Candle 4, Ankh/Salt 5, Diamond 6
        //Tier 3 Spells - Cost 14
        new Spell("Sacrificial Calf", SpellID.SacrificialCalf, 3, DomainID.Waeor)
        .setEffects(SpellEffect.BlessChild, SpellEffect.HexGout)
        .addIngredient(IngredientID.Parchment, 2)
        .addIngredient(IngredientID.Fang, 4);

        new Spell("The Golden Crown", SpellID.TheGoldenCrown, 3, DomainID.Tempus)
        .setEffects(SpellEffect.HexBlindness, SpellEffect.KnowParentage)
        .addIngredient(IngredientID.Parchment, 4)
        .addIngredient(IngredientID.Salt, 2);

        new Spell("Masquerade", SpellID.Masquerade, 3, DomainID.Immolian)
        .setEffects(SpellEffect.InspireObsession, SpellEffect.SanctifyPerformance)
        .addIngredient(IngredientID.Parchment, 2)
        .addIngredient(IngredientID.Candle, 3);

        new Spell("Mummify", SpellID.Mummify, 3, DomainID.Penumok)
        .setEffects(SpellEffect.CureLeprosy, SpellEffect.InspireDespondency)
        .addIngredient(IngredientID.Parchment, 2)
        .addIngredient(IngredientID.Ink, 6);

        new Spell("Unstopper Truth", SpellID.UnstopperTruth, 3, DomainID.Anestra)
        .setEffects(SpellEffect.UnderstandLanguage, SpellEffect.GiveSpeach)
        .addIngredient(IngredientID.Parchment, 2)
        .addIngredient(IngredientID.Quartz, 2);


        new Spell("Serpent's Molt", SpellID.SerpentsMolt, 3, DomainID.Waeor)
        .setEffects(SpellEffect.CureLeprosy)
        .addIngredient(IngredientID.Parchment, 2)
        .addIngredient(IngredientID.Fang, 4);

        new Spell("Satyr's Song", SpellID.DruidsDance, 3, DomainID.Waeor)
        .setEffects(SpellEffect.SanctifyPerformance)
        .addIngredient(IngredientID.Parchment, 2)
        .addIngredient(IngredientID.Fang, 4);

        new Spell("Divine Arrival", SpellID.DivineArrival, 3, DomainID.Tempus)
        .setEffects(SpellEffect.BlessChild)
        .addIngredient(IngredientID.Parchment, 4)
        .addIngredient(IngredientID.Salt, 2);

        new Spell("Legendary Focus", SpellID.LegendaryFocus, 3, DomainID.Tempus)
        .setEffects(SpellEffect.InspireObsession)
        .addIngredient(IngredientID.Parchment, 4)
        .addIngredient(IngredientID.Salt, 2);

        new Spell("Intuit Intention", SpellID.IntuitIntention, 3, DomainID.Immolian)
        .setEffects(SpellEffect.UnderstandLanguage)
        .addIngredient(IngredientID.Parchment, 2)
        .addIngredient(IngredientID.Candle, 3);

        new Spell("Loosen Tongue", SpellID.LoosenTongue, 3, DomainID.Immolian)
        .setEffects(SpellEffect.GiveSpeach)
        .addIngredient(IngredientID.Parchment, 2)
        .addIngredient(IngredientID.Candle, 3);

        new Spell("Darkness of Depths", SpellID.DarknessOfDepths, 3, DomainID.Penumok)
        .setEffects(SpellEffect.HexBlindness)
        .addIngredient(IngredientID.Parchment, 2)
        .addIngredient(IngredientID.Ink, 6);

        new Spell("Corrupt Blood", SpellID.CorruptBlood, 3, DomainID.Penumok)
        .setEffects(SpellEffect.HexGout)
        .addIngredient(IngredientID.Parchment, 2)
        .addIngredient(IngredientID.Ink, 6);

        new Spell("Chart Ancestry", SpellID.ChartAncestry, 3, DomainID.Anestra)
        .setEffects(SpellEffect.KnowParentage)
        .addIngredient(IngredientID.Parchment, 2)
        .addIngredient(IngredientID.Quartz, 2);

        new Spell("Reveal Futility", SpellID.RevealFutility, 3, DomainID.Anestra)
        .setEffects(SpellEffect.InspireDespondency)
        .addIngredient(IngredientID.Parchment, 2)
        .addIngredient(IngredientID.Quartz, 2);



        //Tier 4 Spells

        //Tier 5 Spells


        RandomSpells = new WeightedCollection <SpellID>();
        foreach (KeyValuePair <SpellID, Spell> entry in Definitions)
        {
            RandomSpells.AddWeight(entry.Key, 10 - entry.Value.skill);
        }
    }
Ejemplo n.º 4
0
        public static VoxelMaterial Lerp(VoxelMaterial a, VoxelMaterial b, float t)
        {
            VoxelMaterial output = new VoxelMaterial();

            output.Properties = VoxelMaterialBasic.Lerp(a.Properties, b.Properties, t);

            if (t <= 0.0f)
            {
                output.DressingLookup   = new SerializableDictionary <VoxelFace, int>(a.DressingLookup);
                output.DressingSettings = new List <WeightedCollection <GameObject> >(a.DressingSettings);
            }
            else if (t >= 1.0f)
            {
                output.DressingLookup   = new SerializableDictionary <VoxelFace, int>(b.DressingLookup);
                output.DressingSettings = new List <WeightedCollection <GameObject> >(b.DressingSettings);
            }
            else
            {
                output.DressingLookup   = new SerializableDictionary <VoxelFace, int>();
                output.DressingSettings = new List <WeightedCollection <GameObject> >();


                foreach (VoxelFace face in VoxelFaceHelpers.ToFaceCollection(VoxelFaces.All))
                {
                    if (!a.DressingLookup.TryGetValue(face, out int aIdx))
                    {
                        aIdx = -1;
                    }
                    if (!b.DressingLookup.TryGetValue(face, out int bIdx))
                    {
                        bIdx = -1;
                    }

                    WeightedCollection <GameObject> settings = null;

                    if (aIdx != -1 && bIdx != -1)
                    {
                        // Mix settings
                        settings = new WeightedCollection <GameObject>();
                        settings.Insert(t, a.DressingSettings[aIdx]);
                        settings.Insert(1.0f - t, b.DressingSettings[aIdx]);
                    }
                    else if (aIdx != -1)
                    {
                        settings = a.DressingSettings[aIdx];
                    }
                    else if (bIdx != -1)
                    {
                        settings = b.DressingSettings[bIdx];
                    }

                    if (settings != null)
                    {
                        int index = output.DressingSettings.Count;
                        output.DressingSettings.Add(settings);
                        output.DressingLookup.Add(face, index);
                    }
                }
            }

            return(output);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Construct a new instance with given ASCII tiles.
 /// </summary>
 public TerrainTypeInfo(string name, WeightedCollection <Tile> tiles)
 {
     this.Name  = name;
     this.Tiles = tiles;
 }