/* DDL Monster spec 1) Variables with predefined meanings, used by the hard-wired code Name Description Valid Types ---- ----------- ----------- HP Initial Hit Points Int,Dice AC Armour Class Int,Dice Attacks Attack Descriptions List (*) MP Initial Magic Points Int,Dice Mana Initial Mana Int,Dice Description Monster's description String The Attacks List currently takes the form [name,type,dam] repeated once for each attack. This is not general enough !!. Type is intended to define attacks as fiery attacks or whatever for resistance purposes. Any class which does not define all of these is only a superclass and cannot be instantiated (e.g. you can't meet an OrcFamily!) I am currently assuming that the name used in e.g. "the kobold hits you" is always the same as the class name.... These shouldn't really be called variables : at run time, they are not intended to be variable, they are constant, and could be shared between all monsters of the same class. 2) Methods with hard-wired code definitions - cannot be overridden with DDL code, but can be called from DDL code. Can't think of any. I was going to have "GetHP" but that doesn't really need to exist at all. 3) Methods with hard-wired default definitions, which can be overridden with DDL code (at a performance penalty) Attack(Victim,AttackNumber) Perform attack number "AttackNumber" on the monster "Victim". Default function finds attack description from the List "Attacks" and performs it. Not really sure why you might want to override this. */ /* Example monsters. Build up this section since it will make us aware of what we need for a complete DDL. Haven't done any descriptions yet - lack of inspiration */ /* OrcFamily - Orc-like creatures. */ Monster:OrcFamily { vars { MP=0; Mana=0; ClawDamage; // defines new variable which can be used below Attacks=[claw,normal,ClawDamage]x2; // Can't instantiate OrcFamily's because of other undefined // instance vars } } Monster:OrcFamily:Kobold { vars { HP=1d4; AC=3; ClawDamage=1d2; } } Monster:OrcFamily:Goblin { vars { HP=1d6; AC=5; ClawDamage=1d3; } } Monster:OrcFamily:HobGoblin { vars { HP=1d8; AC=7; ClawDamage=1d4; } } Monster:OrcFamily:Orc { vars { HP=1d12; AC=9; ClawDamage=1d6; } } /* CatFamily - cat-like creatures */ Monster:Monster:CatFamily { vars { MP=0; Mana=0; ClawDamage; BiteDamage; Attacks=[claw,normal,ClawDamage]x4,]bite,normal,BiteDamage]; } } Monster:CatFamily:Lynx { vars { ClawDamage=1d3; BiteDamage=1d6; HP=1d10; AC=10; } } Monster:CatFamily:Puma { vars { ClawDamage=1d2; BiteDamage=1d8; HP=1d12; AC=10; } } Monster:CatFamily:Lion { vars { ClawDamage=1d6; BiteDamage=1d10; HP=4d10; AC=10; } } Monster:CatFamily:Tiger { vars { ClawDamage=1d10; BiteDamage=1d12; HP=3d10; AC=15; } } /* Dragons A bit more ambitious this trying to stretch the syntax a bit, see what's missing. Playing around with multiple inheritance here. It could well end in tears. Basic idea is that the differences between dragons are: 1) Scale: Bigger dragons have more dice of HP, Mana, damage 2) Colours: Different colour dragons have different strength claws, bites, and so on. */ Monster:Dragon { vars { NumDice; HitDice; ManaDice; MPDice; BreathDice; BreathType; HP=(NumDice)d(HitDice); MP=(NumDice)d(MPDice); Mana=(NumDice)d(ManaDice); BreathDamage=(NumDice)d(BreathDice); NumClaws=0; NumBites=0; NumTails=0; NumWings=0; ClawDice; BiteDice; TailDice; WingDice; ClawDamage=(NumDice)d(ClawDice); BiteDamage=(NumDice)d(BiteDice); TailDamage=(NumDice)d(TailDice); WingDamage=(NumDice)d(WingDice); Attacks=[claw,normal,ClawDamage]xNumClaws, [bite,normal,BiteDamage]xNumBites, [tail,normal,TailDamage]xNumTails, [wing,normal,WindDamage]xNumWings, [breath,BreathType,BreathDamage]; BaseAC; ACBonus; AC=BaseAC*ACFactor; } } /* Different ages of dragon have different numbers of dice and attacks */ Monster:Dragon:Baby { vars { BaseAC=10; NumDice=4; NumClaws=2; NumBites=1; } } Monster:Dragon:Young { vars { BaseAC=15; NumDice=8; NumClaws=2; NumBites=1; NumTails=1; } } Monster:Dragon:Adult { vars { BaseAC=20; NumDice=12; NumClaws=2; NumBites=1; NumTails=1; NumWings=2; } } Monster:Dragon:Mature { vars { BaseAC=30; NumDice=16; NumClaws=3; NumBites=2; NumTails=1; NumWings=2; } } Monster:Dragon:Ancient { vars { BaseAC=50; NumDice=25; NumClaws=4; NumBites=2; NumTails=2; NumWings=2; } } /* Different colours of dragon have different attack powers. */ Monster:Dragon:Red { vars { BreathType=fire; ManaDice=0; // Red dragons have no healers ability MPDice=10; HitDice=10; ClawDice=3; BiteDice=5; TailDice=2; WingDice=2; ACFactor=2; } } Monster:Dragon:White { vars { BreathType=cold; ManaDice=8; MPDice=2; // White dragons have very little magical ability HitDice=6; ClawDice=2; BiteDice=3; TailDice=1; WingDice=1; ACFactor=1; } } /* And finally, list the actual possibilities: There is no class data here, because each class is fully defined by its two superclasses */ (Monster:Dragon:Baby,Monster:Dragon:Red):BabyRedDragon; (Monster:Dragon:Young,Monster:Dragon:Red):YoungRedDragon; (Monster:Dragon:Adult,Monster:Dragon:Red):AdultRedDragon; (Monster:Dragon:Mature,Monster:Dragon:Red):MatureRedDragon; (Monster:Dragon:Ancient,Monster:Dragon:Red):AncientRedDragon; (Monster:Dragon:Baby,Monster:Dragon:White):BabyWhiteDragon; (Monster:Dragon:Young,Monster:Dragon:White):YoungWhiteDragon; (Monster:Dragon:Adult,Monster:Dragon:White):AdultWhiteDragon; (Monster:Dragon:Mature,Monster:Dragon:White):MatureWhiteDragon; (Monster:Dragon:Ancient,Monster:Dragon:White):AncientWhiteDragon; // Probably we should allow // Monster:Dragon:(Ancient,Red):AncientRedDragon as a short cut...