umorna/source/game.c

208 lines
14 KiB
C
Raw Normal View History

#include "core.h"
#include "game.h"
#include <xolatile/chads.c>
static void define_traits (void) {
strength = chad_define_trait ("Strength", 1, 1, 10);
dexterity = chad_define_trait ("Dexterity", 1, 1, 10);
wisdom = chad_define_trait ("Wisdom", 1, 1, 10);
}
static void define_skills (void) {
swords = chad_define_skill ("Swords", 1, 1, 100);
axes = chad_define_skill ("Axes", 1, 1, 100);
maces = chad_define_skill ("Maces", 1, 1, 100);
staves = chad_define_skill ("Staves", 1, 1, 100);
bows = chad_define_skill ("Bows", 1, 1, 100);
crossbows = chad_define_skill ("Crossbows", 1, 1, 100);
slings = chad_define_skill ("Slings", 1, 1, 100);
shields = chad_define_skill ("Shields", 1, 1, 100);
armour = chad_define_skill ("Armour", 1, 1, 100);
alchemy = chad_define_skill ("Alchemy", 1, 1, 100);
medicine = chad_define_skill ("Medicine", 1, 1, 100);
mercantile = chad_define_skill ("Mercantile", 1, 1, 100);
farmer = chad_define_skill ("Farmer", 1, 1, 100);
miner = chad_define_skill ("Miner", 1, 1, 100);
lumber = chad_define_skill ("Lumber", 1, 1, 100);
traps = chad_define_skill ("Traps", 1, 1, 100);
water_magic = chad_define_skill ("Water Magic", 1, 1, 100);
earth_magic = chad_define_skill ("Earth Magic", 1, 1, 100);
wind_magic = chad_define_skill ("Wind Magic", 1, 1, 100);
black_magic = chad_define_skill ("Black Magic", 1, 1, 100);
rune_magic = chad_define_skill ("Rune Magic", 1, 1, 100);
summon_magic = chad_define_skill ("Summon Magic", 1, 1, 100);
ritual_magic = chad_define_skill ("Ritual Magic", 1, 1, 100);
charm_magic = chad_define_skill ("Charm Magic", 1, 1, 100);
}
static void define_values (void) {
coin = chad_define_value ("Coin", 1);
food = chad_define_value ("Food", 2);
wood = chad_define_value ("Wood", 5);
stone = chad_define_value ("Stone", 7);
iron = chad_define_value ("Iron", 19);
gold = chad_define_value ("Silver", 23);
silver = chad_define_value ("Gold", 29);
coal = chad_define_value ("Coal", 13);
gems = chad_define_value ("Gems", 31);
mana = chad_define_value ("Mana", 37);
}
static void define_effects (void) {
gain_minor_strength = chad_define_effect (CHAD_ENTITY_TRAIT, CHAD_TARGET_SELF | CHAD_TARGET_INCREASE, strength, 1);
gain_major_strength = chad_define_effect (CHAD_ENTITY_TRAIT, CHAD_TARGET_SELF | CHAD_TARGET_INCREASE, strength, 3);
gain_great_strength = chad_define_effect (CHAD_ENTITY_TRAIT, CHAD_TARGET_SELF | CHAD_TARGET_INCREASE, strength, 7);
}
static void define_mights (void) {
might = chad_define_might ("Might", gain_minor_strength);
}
static void define_magics (void) {
magic = chad_define_magic ("Magic", 3, gain_major_strength);
}
static void define_races (void) {
orc = chad_define_race ("Orc", strength, axes, wood);
human = chad_define_race ("Human", dexterity, medicine, iron);
elf = chad_define_race ("Elf", wisdom, rune_magic, gems);
}
static void define_items (void) {
iron_mace = chad_define_item ("Iron Mace", 2, CHAD_ITEM_WEAPON, gain_minor_strength);
iron_sword = chad_define_item ("Iron Sword", 3, CHAD_ITEM_WEAPON, gain_minor_strength);
iron_axe = chad_define_item ("Iron Axe", 2, CHAD_ITEM_WEAPON, gain_minor_strength);
}
static void define_units (void) {
gnoll = chad_define_unit ("Gnoll", "Dirt-Hut", orc, CHAD_UNIT_RANGE, 1, 2, 7, -1);
gnoll_shaman = chad_define_unit ("Gnoll Shaman", "Treehouse", orc, CHAD_UNIT_MAGIC, 1, 3, 7, -1);
goblin = chad_define_unit ("Goblin", "Dirty Shed", orc, CHAD_UNIT_MELEE, 2, 3, 7, -1);
hob_goblin = chad_define_unit ("Hob-Goblin", "Old Barracks", orc, CHAD_UNIT_MELEE | CHAD_UNIT_MAGIC, 3, 5, 7, -1);
thief = chad_define_unit ("Thief", "Thief Storehouse", orc, CHAD_UNIT_MELEE, 3, 7, 7, -1);
looter = chad_define_unit ("Looter", "Abandoned Manor", orc, CHAD_UNIT_RANGE, 5, 7, 7, -1);
warrior = chad_define_unit ("Warrior", "Longhouse", orc, CHAD_UNIT_MELEE, 7, 11, 7, -1);
shaman = chad_define_unit ("Shaman", "Cottage", orc, CHAD_UNIT_MAGIC, 7, 11, 7, -1);
chief = chad_define_unit ("Chief", "Campgrounds", orc, CHAD_UNIT_MELEE | CHAD_UNIT_RANGE, 11, 13, 7, -1);
wolf_rider = chad_define_unit ("Wolf-Rider", "Wold Den", orc, CHAD_UNIT_MELEE | CHAD_UNIT_RANGE, 17, 17, 7, -1);
boar_rider = chad_define_unit ("Boar-Rider", "Boar Ranch", orc, CHAD_UNIT_RANGE, 19, 23, 7, -1);
overlord = chad_define_unit ("Overlord", "Orcish Temple", orc, CHAD_UNIT_MELEE | CHAD_UNIT_MAGIC, 23, 13, 7, -1);
ogre = chad_define_unit ("Ogre", "Highlands", orc, CHAD_UNIT_MELEE, 29, 23, 7, -1);
ogre_mage = chad_define_unit ("Ogre Mage", "Highland Tower", orc, CHAD_UNIT_MELEE | CHAD_UNIT_MAGIC, 31, 29, 7, -1);
troll = chad_define_unit ("Troll", "Troll Den", orc, CHAD_UNIT_MELEE, 37, 31, 7, -1);
war_troll = chad_define_unit ("War Troll", "Cavern-Fort", orc, CHAD_UNIT_MELEE | CHAD_UNIT_RANGE, 41, 37, 7, -1);
basilisk = chad_define_unit ("Basilisk", "Dungeon", orc, CHAD_UNIT_MELEE | CHAD_UNIT_EXTRA, 53, 59, 7, -1);
wyvern = chad_define_unit ("Wyvern", "Swamp Pit", orc, CHAD_UNIT_MELEE | CHAD_UNIT_EXTRA, 59, 53, 7, -1);
peasant = chad_define_unit ("Peasant", "Farm", human, CHAD_UNIT_MELEE, 1, 1, 7, -1);
scout = chad_define_unit ("Scout", "Scout Shack", human, CHAD_UNIT_RANGE, 2, 3, 7, -1);
hunter = chad_define_unit ("Hunter", "Archery", human, CHAD_UNIT_RANGE, 2, 3, 7, -1);
swordman = chad_define_unit ("Swordman", "House of Slashing", human, CHAD_UNIT_MELEE, 3, 5, 7, -1);
axeman = chad_define_unit ("Axeman", "House of Cutting", human, CHAD_UNIT_MELEE, 5, 5, 7, -1);
crossbowman = chad_define_unit ("Crossbowman", "House of Shooting", human, CHAD_UNIT_RANGE, 5, 5, 7, -1);
horseman = chad_define_unit ("Horseman", "Horse Ranch", human, CHAD_UNIT_MELEE, 7, 11, 7, -1);
guard = chad_define_unit ("Guard", "Guard Barracks", human, CHAD_UNIT_MELEE, 7, 7, 7, -1);
elite_guard = chad_define_unit ("Elite Guard", "Guard Home", human, CHAD_UNIT_MELEE, 13, 11, 7, -1);
lancer = chad_define_unit ("Lancer", "Riding Meadow", human, CHAD_UNIT_MELEE | CHAD_UNIT_RANGE, 17, 17, 7, -1);
knight = chad_define_unit ("Knight", "Mansion of Honour", human, CHAD_UNIT_MELEE, 19, 23, 7, -1);
kingsman = chad_define_unit ("Kingsman", "King's Academy", human, CHAD_UNIT_MELEE, 19, 17, 7, -1);
mage = chad_define_unit ("Mage", "School of Mana", human, CHAD_UNIT_MAGIC, 23, 7, 7, -1);
arch_mage = chad_define_unit ("Arch-Mage", "Temple of Mana", human, CHAD_UNIT_MAGIC, 29, 11, 7, -1);
giant = chad_define_unit ("Giant", "Mound", human, CHAD_UNIT_MELEE, 41, 59, 7, -1);
war_giant = chad_define_unit ("War Giant", "Mound-Fort", human, CHAD_UNIT_MELEE | CHAD_UNIT_RANGE, 43, 67, 7, -1);
griffin = chad_define_unit ("Griffin", "Griffin Nest", human, CHAD_UNIT_MELEE, 47, 53, 7, -1);
roc = chad_define_unit ("Roc", "Heavenly Temple", human, CHAD_UNIT_MELEE | CHAD_UNIT_MAGIC, 53, 61, 7, -1);
sprite = chad_define_unit ("Sprite", "Little Lamp", elf, CHAD_UNIT_MELEE, 1, 1, 7, -1);
nature_spirit = chad_define_unit ("Nature Spirit", "Flower Palace", elf, CHAD_UNIT_MELEE, 1, 1, 7, -1);
half_elf = chad_define_unit ("Half-Elf", "Slums", elf, CHAD_UNIT_MELEE, 1, 3, 7, -1);
ranger = chad_define_unit ("Ranger", "Ranger Guild", elf, CHAD_UNIT_MELEE, 3, 5, 7, -1);
archer = chad_define_unit ("Archer", "Arrow House", elf, CHAD_UNIT_MELEE | CHAD_UNIT_RANGE, 3, 7, 7, -1);
elite_archer = chad_define_unit ("Elite Archer", "Arrow Fortress", elf, CHAD_UNIT_MELEE | CHAD_UNIT_RANGE, 5, 7, 7, -1);
blademaster = chad_define_unit ("Blademaster", "School of Blades", elf, CHAD_UNIT_MELEE | CHAD_UNIT_MAGIC, 7, 11, 7, -1);
water_mage = chad_define_unit ("Water Mage", "Water Temple", elf, CHAD_UNIT_MAGIC, 11, 11, 7, -1);
earth_mage = chad_define_unit ("Earth Mage", "Earth Temple", elf, CHAD_UNIT_MAGIC, 13, 13, 7, -1);
wind_mage = chad_define_unit ("Wind Mage", "Wind Temple", elf, CHAD_UNIT_MAGIC, 13, 17, 7, -1);
rune_mage = chad_define_unit ("Rune Mage", "Rune Monastery", elf, CHAD_UNIT_MAGIC, 17, 19, 7, -1);
runemaster = chad_define_unit ("Runemaster", "Ancient Ruins", elf, CHAD_UNIT_MAGIC, 19, 23, 7, -1);
sacrificer = chad_define_unit ("Sacrificer", "Altair", elf, CHAD_UNIT_MAGIC, 23, 19, 7, -1);
elk_rider = chad_define_unit ("Elk Rider", "Elk Ranch-House", elf, CHAD_UNIT_MELEE, 29, 23, 7, -1);
warmaster = chad_define_unit ("Warmaster", "Elven Fort", elf, CHAD_UNIT_MELEE | CHAD_UNIT_MAGIC, 41, 59, 7, -1);
coal_golem = chad_define_unit ("Coal Golem", "Old Coal Mine", elf, CHAD_UNIT_MELEE, 43, 53, 7, -1);
iron_golem = chad_define_unit ("Iron Golem", "Old Iron Mine", elf, CHAD_UNIT_MELEE, 47, 67, 7, -1);
sage = chad_define_unit ("Sage", "Cabin in the Woods", elf, CHAD_UNIT_RANGE | CHAD_UNIT_MAGIC, 67, 47, 7, -1);
}
static void define_blocks (void) {
(void) chad_define_block ("Ashland", 0, 12, -1, -1, -1);
(void) chad_define_block ("Ashdirt", 0, 6, -1, -1, -1);
(void) chad_define_block ("Ashdust", 0, 6, -1, -1, -1);
(void) chad_define_block ("Garbage", CHAD_BLOCK_RANDOM, 12, -1, -1, -1);
(void) chad_define_block ("Ashdirt", CHAD_BLOCK_UP, 1, 0, 1, -1);
(void) chad_define_block ("Ashdirt", CHAD_BLOCK_DOWN, 1, 0, 1, -1);
(void) chad_define_block ("Ashdirt", CHAD_BLOCK_LEFT, 1, 0, 1, -1);
(void) chad_define_block ("Ashdirt", CHAD_BLOCK_RIGHT, 1, 0, 1, -1);
(void) chad_define_block ("Ashdirt", CHAD_BLOCK_UP | CHAD_BLOCK_LEFT, 1, 0, 1, -1);
(void) chad_define_block ("Ashdirt", CHAD_BLOCK_UP | CHAD_BLOCK_RIGHT, 1, 0, 1, -1);
(void) chad_define_block ("Ashdirt", CHAD_BLOCK_DOWN | CHAD_BLOCK_LEFT, 1, 0, 1, -1);
(void) chad_define_block ("Ashdirt", CHAD_BLOCK_DOWN | CHAD_BLOCK_RIGHT, 1, 0, 1, -1);
(void) chad_define_block ("Ashdirt", CHAD_BLOCK_UP | CHAD_BLOCK_LEFT, 1, 1, 0, -1);
(void) chad_define_block ("Ashdirt", CHAD_BLOCK_UP | CHAD_BLOCK_RIGHT, 1, 1, 0, -1);
(void) chad_define_block ("Ashdirt", CHAD_BLOCK_DOWN | CHAD_BLOCK_LEFT, 1, 1, 0, -1);
(void) chad_define_block ("Ashdirt", CHAD_BLOCK_DOWN | CHAD_BLOCK_RIGHT, 1, 1, 0, -1);
(void) chad_define_block ("Ashdust", CHAD_BLOCK_UP, 1, 0, 2, -1);
(void) chad_define_block ("Ashdust", CHAD_BLOCK_DOWN, 1, 0, 2, -1);
(void) chad_define_block ("Ashdust", CHAD_BLOCK_LEFT, 1, 0, 2, -1);
(void) chad_define_block ("Ashdust", CHAD_BLOCK_RIGHT, 1, 0, 2, -1);
(void) chad_define_block ("Ashdust", CHAD_BLOCK_UP | CHAD_BLOCK_LEFT, 1, 0, 2, -1);
(void) chad_define_block ("Ashdust", CHAD_BLOCK_UP | CHAD_BLOCK_RIGHT, 1, 0, 2, -1);
(void) chad_define_block ("Ashdust", CHAD_BLOCK_DOWN | CHAD_BLOCK_LEFT, 1, 0, 2, -1);
(void) chad_define_block ("Ashdust", CHAD_BLOCK_DOWN | CHAD_BLOCK_RIGHT, 1, 0, 2, -1);
(void) chad_define_block ("Ashdust", CHAD_BLOCK_UP | CHAD_BLOCK_LEFT, 1, 2, 0, -1);
(void) chad_define_block ("Ashdust", CHAD_BLOCK_UP | CHAD_BLOCK_RIGHT, 1, 2, 0, -1);
(void) chad_define_block ("Ashdust", CHAD_BLOCK_DOWN | CHAD_BLOCK_LEFT, 1, 2, 0, -1);
(void) chad_define_block ("Ashdust", CHAD_BLOCK_DOWN | CHAD_BLOCK_RIGHT, 1, 2, 0, -1);
}
void game_configure (void) {
define_traits ();
define_skills ();
define_values ();
define_effects ();
define_mights ();
define_magics ();
define_races ();
define_items ();
define_units ();
define_blocks ();
(void) chad_define_world ("Ashlands", 0XBEEF, 0, chad_block_count);
chad_configure ();
}
int strength, dexterity, wisdom;
int swords, axes, maces, staves, bows, crossbows, slings, shields, armour, alchemy, medicine, mercantile, farmer, miner, lumber, traps, water_magic, earth_magic, wind_magic,
black_magic, rune_magic, summon_magic, ritual_magic, charm_magic;
int coin, food, wood, stone, iron, gold, silver, coal, gems, mana;
int gain_minor_strength, gain_major_strength, gain_great_strength;
int might;
int magic;
int orc, human, elf;
int iron_mace, iron_sword, iron_axe;
int gnoll, gnoll_shaman, goblin, hob_goblin, thief, looter, warrior, shaman, chief, wolf_rider, boar_rider, overlord, ogre, ogre_mage, troll, war_troll, basilisk, wyvern, peasant,
scout, hunter, swordman, axeman, crossbowman, horseman, guard, elite_guard, lancer, knight, kingsman, mage, arch_mage, giant, war_giant, griffin, roc, sprite, nature_spirit,
half_elf, ranger, archer, elite_archer, blademaster, water_mage, earth_mage, wind_mage, rune_mage, runemaster, sacrificer, elk_rider, warmaster, coal_golem, iron_golem, sage;