diff --git a/game/engine/Birther.lua b/game/engine/Birther.lua index 940c215a590d1550a73235714f65fc50a606571e..0bbfe67a9be27d1f41aa371a0a6cbced832aca80 100644 --- a/game/engine/Birther.lua +++ b/game/engine/Birther.lua @@ -175,6 +175,7 @@ function _M:next() self.changed = true if self.list then table.insert(self.descriptors, self.list[self.sel]) + if self.list[self.sel].on_select then self.list[self.sel]:on_select() end self.cur_order = self.cur_order + 1 if not self.order[self.cur_order] then diff --git a/game/modules/tome/class/World.lua b/game/modules/tome/class/World.lua index bd90f904c1c422e0b7aff40f61316e579871bd7a..836495abdd592ee7e2324625815a55e4181f17cd 100644 --- a/game/modules/tome/class/World.lua +++ b/game/modules/tome/class/World.lua @@ -50,8 +50,9 @@ end -- @param id the achivement to gain -- @param src who did it function _M:gainAchievement(id, src, ...) + local a = self.achiev_defs[id] -- Do not unlock things in easy mode - if game.difficulty == game.DIFFICULTY_EASY then return end + if not a or (game.difficulty == game.DIFFICULTY_EASY and not a.tutorial) then return end engine.interface.WorldAchievements.gainAchievement(self, id, src, ...) end diff --git a/game/modules/tome/class/interface/Combat.lua b/game/modules/tome/class/interface/Combat.lua index c05f2feff1fcc7f282e19b7844ebf8f9107dfdac..e89a2707e43a8916a5ebea1cdb226cf791aa151a 100644 --- a/game/modules/tome/class/interface/Combat.lua +++ b/game/modules/tome/class/interface/Combat.lua @@ -467,7 +467,7 @@ function _M:combatDamage(weapon) end local talented_mod = math.sqrt(self:combatCheckTraining(weapon) / 10) + 1 - local power = math.min(self.combat_dam + (weapon.dam or 1) + add, 1) + local power = math.max(self.combat_dam + (weapon.dam or 1) + add, 1) power = (math.sqrt(power / 10) - 1) * 0.8 + 1 print(("[COMBAT DAMAGE] power(%f) totstat(%f) talent_mod(%f)"):format(power, totstat, talented_mod)) return totstat / 1.5 * power * talented_mod diff --git a/game/modules/tome/data/achievements/quests.lua b/game/modules/tome/data/achievements/quests.lua index e28a6cbff57994932225478c6b2b3529c3919471..3e3b4d09ff481c479558ef73ef90e8036898d272 100644 --- a/game/modules/tome/data/achievements/quests.lua +++ b/game/modules/tome/data/achievements/quests.lua @@ -17,6 +17,13 @@ -- Nicolas Casalini "DarkGod" -- darkgod@te4.org +--------------- Tutorial objectives +newAchievement{ + name = "Baby steps", + desc = [[Completed ToME4 tutorial mode.]], + tutorial = true, +} + --------------- Main objectives newAchievement{ name = "Vampire crusher", diff --git a/game/modules/tome/data/birth/classes/tutorial.lua b/game/modules/tome/data/birth/classes/tutorial.lua new file mode 100644 index 0000000000000000000000000000000000000000..9bfc07a9d297d3feeaace0e1523952cd6013ec80 --- /dev/null +++ b/game/modules/tome/data/birth/classes/tutorial.lua @@ -0,0 +1,82 @@ +-- ToME - Tales of Middle-Earth +-- Copyright (C) 2009, 2010 Nicolas Casalini +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org + +newBirthDescriptor{ + type = "class", + name = "Tutorial Adventurer", + desc = { + "Adventurers have a generic talents-set to teach to young ones.", + }, + descriptor_choices = + { + subclass = + { + __ALL__ = "disallow", + ["Tutorial Adventurer"] = "allow", + }, + }, + copy = { + max_life = 120, + life_rating = 12, + mana_regen = 0.2, + life_regen = 1, + mana_rating = 7, + resolvers.generic(function(e) + e.hotkey[10] = {"inventory", "potion of lesser mana"} + end), + }, +} + +newBirthDescriptor{ + type = "subclass", + name = "Tutorial Adventurer", + desc = { + "Adventurers have a generic talents-set to teach to young ones.", + }, + stats = { str=10, con=5, dex=5, mag=10, wil=5, cun=5 }, + talents_types = { + ["technique/shield-offense"]={true, 0.3}, + ["technique/shield-defense"]={true, 0.3}, + ["technique/combat-training"]={true, 0.3}, + ["cunning/survival"]={true, 0.3}, + ["spell/fire"]={true, 0.3}, + ["spell/air"]={true, 0.3}, + ["spell/arcane"]={true, 0.3}, + }, + talents = { + [ActorTalents.T_SHIELD_PUMMEL] = 2, + [ActorTalents.T_SHIELD_WALL] = 2, + [ActorTalents.T_WEAPON_COMBAT] = 2, + [ActorTalents.T_HEAVY_ARMOUR_TRAINING] = 2, + [ActorTalents.T_FLAME] = 2, + [ActorTalents.T_LIGHTNING] = 2, + [ActorTalents.T_ARCANE_POWER] = 2, + }, + copy = { + resolvers.equip{ id=true, + {type="weapon", subtype="longsword", name="iron longsword", autoreq=true}, + {type="armor", subtype="shield", name="iron shield", autoreq=true}, + {type="armor", subtype="heavy", name="iron mail armour", autoreq=true} + }, + resolvers.inventory{ id=true, + {type="potion", subtype="potion", name="potion of lesser mana", ego_chance=-1000}, + {type="potion", subtype="potion", name="potion of lesser mana", ego_chance=-1000}, + }, + }, +} diff --git a/game/modules/tome/data/birth/descriptors.lua b/game/modules/tome/data/birth/descriptors.lua index 2a7443a3f93242d54ad3a6e16c60b4f7c7e80b9f..4f333d0d3be3fb13d38522500691f3da3b67e705 100644 --- a/game/modules/tome/data/birth/descriptors.lua +++ b/game/modules/tome/data/birth/descriptors.lua @@ -17,9 +17,6 @@ -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -setAuto("subclass", false) -setAuto("subrace", false) - newBirthDescriptor{ type = "base", name = "base", @@ -128,6 +125,7 @@ newBirthDescriptor{ load("/data/birth/worlds.lua") -- Races +load("/data/birth/races/tutorial.lua") load("/data/birth/races/human.lua") load("/data/birth/races/elf.lua") load("/data/birth/races/hobbit.lua") @@ -141,6 +139,7 @@ load("/data/birth/races/undead.lua") load("/data/birth/sexes.lua") -- Classes +load("/data/birth/classes/tutorial.lua") load("/data/birth/classes/warrior.lua") load("/data/birth/classes/archer.lua") load("/data/birth/classes/rogue.lua") diff --git a/game/modules/tome/data/birth/races/tutorial.lua b/game/modules/tome/data/birth/races/tutorial.lua new file mode 100644 index 0000000000000000000000000000000000000000..59f2bd222ad462c245e41f1df9309016f70e5cf9 --- /dev/null +++ b/game/modules/tome/data/birth/races/tutorial.lua @@ -0,0 +1,58 @@ +-- ToME - Tales of Middle-Earth +-- Copyright (C) 2009, 2010 Nicolas Casalini +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org + +--------------------------------------------------------- +-- Humans -- +--------------------------------------------------------- +newBirthDescriptor{ + type = "race", + name = "Tutorial Human", + desc = { + "A special tutorial race.", + }, + descriptor_choices = + { + subrace = + { + ["Tutorial Human"] = "allow", + __ALL__ = "disallow", + }, + }, + talents = {}, + experience = 1.0, + copy = { + faction = "reunited-kingdom", + type = "humanoid", subtype="human", + }, +} + +newBirthDescriptor +{ + type = "subrace", + name = "Tutorial Human", + desc = { + "Humans hailing from the northen town of Bree. A common kind of man, unremarkable in all respects.", + }, + copy = { + default_wilderness = {1, 1, "wilderness-tutorial"}, + starting_zone = "tutorial", + starting_quest = "tutorial", + starting_intro = "tutorial", + }, +} diff --git a/game/modules/tome/data/birth/worlds.lua b/game/modules/tome/data/birth/worlds.lua index de083125ad56924f1f63a48ce8aebfb39ca6560f..fff95e14bbed79e45244f1e88beacbe5309a73c1 100644 --- a/game/modules/tome/data/birth/worlds.lua +++ b/game/modules/tome/data/birth/worlds.lua @@ -64,7 +64,7 @@ newBirthDescriptor{ { "The tutorial will explain the basics of the game to get you started.", }, - on_select = function() + on_select = function(what) setAuto("subclass", false) setAuto("subrace", false) end, @@ -73,22 +73,22 @@ newBirthDescriptor{ race = { __ALL__ = "forbid", - Human = "allow", + ["Tutorial Human"] = "allow", }, subrace = { __ALL__ = "forbid", - ["Dúnadan"] = "allow", + ["Tutorial Human"] = "allow", }, class = { __ALL__ = "forbid", - Warrior = "allow", + ["Tutorial Adventurer"] = "allow", }, subclass = { __ALL__ = "forbid", - Fighter = "allow", + ["Tutorial Adventurer"] = "allow", }, }, } diff --git a/game/modules/tome/data/quests/tutorial.lua b/game/modules/tome/data/quests/tutorial.lua new file mode 100644 index 0000000000000000000000000000000000000000..3964c7ff23c329c040836df5223550bddaac00d2 --- /dev/null +++ b/game/modules/tome/data/quests/tutorial.lua @@ -0,0 +1,25 @@ +-- ToME - Tales of Middle-Earth +-- Copyright (C) 2009, 2010 Nicolas Casalini +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org + +name = "Tutorial" +desc = function(self, who) + local desc = {} + desc[#desc+1] = "You must venture in the heart of the forest and kill the Lone Wolf, who randomly attacks villagers." + return table.concat(desc, "\n") +end diff --git a/game/modules/tome/data/texts/intro-tutorial.lua b/game/modules/tome/data/texts/intro-tutorial.lua new file mode 100644 index 0000000000000000000000000000000000000000..1625dd692cb4d30c9ddf39e95b4d6ca33daef6c6 --- /dev/null +++ b/game/modules/tome/data/texts/intro-tutorial.lua @@ -0,0 +1,46 @@ +-- ToME - Tales of Middle-Earth +-- Copyright (C) 2009, 2010 Nicolas Casalini +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org + +return [[Welcome #LIGHT_GREEN#]]..name..[[#WHITE#. +#LIGHT_GREEN#Welcome to ToME 4!#LAST# + +This tutorial will present you with a short quest to familiarise yourself with the game. +You are a human adventurer, able in both melee combat and spell casting, sent into the forest by the local village to dispose of the "Lone Wolf". + +The basic form of attack is a melee blow, to do it simply move toward your target, if it is hostile you will attack it. +You also posses special talents that allow you to perform more powerful attacks, buffs, escapes, ... + +Talents are classified into three kinds: +- Active: those are activable actions, like throwing a fireball or stunning a monster with your shield +- Sustained: those are toggled on/off, ususaly reducing your corresponding ressource as long as they are active +- Passive: those are always 'on' and always provide their benefit + +** Your starting active talents: +- Shield Pummel: You bash your foe with a powerful shield bash, damaging and stunning it +- Flame: Throw a bolt of flames at your target, burning it for a few turns +- Lightning: A jolt of electricity fires from your fingers in straigth line to your target + +** Your starting sustained talents: +- Shield Wall: You take cover behind your shield, improving your defence and armour but reducing your melee offensive power +- Arcane Power: You summon a nexus of magic around you, improving your spell power + +** Your starting passive talents: +- Weapon Combat: Improves your chance to hit with your melee weapon +- Heavy Armour Training: Allows you to wear heavy armour and improves your armour rating with them +]] diff --git a/game/modules/tome/data/zones/tutorial/grids.lua b/game/modules/tome/data/zones/tutorial/grids.lua new file mode 100644 index 0000000000000000000000000000000000000000..649dff9ed66f0d608b12a4bb999101dcdd42386a --- /dev/null +++ b/game/modules/tome/data/zones/tutorial/grids.lua @@ -0,0 +1,21 @@ +-- ToME - Tales of Middle-Earth +-- Copyright (C) 2009, 2010 Nicolas Casalini +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org + +load("/data/general/grids/basic.lua") +load("/data/general/grids/forest.lua") diff --git a/game/modules/tome/data/zones/tutorial/npcs.lua b/game/modules/tome/data/zones/tutorial/npcs.lua new file mode 100644 index 0000000000000000000000000000000000000000..1205f2d8b0fb76112b38d492b52367f9ff650084 --- /dev/null +++ b/game/modules/tome/data/zones/tutorial/npcs.lua @@ -0,0 +1,72 @@ +-- ToME - Tales of Middle-Earth +-- Copyright (C) 2009, 2010 Nicolas Casalini +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org + +load("/data/general/npcs/bear.lua") +load("/data/general/npcs/vermin.lua") +load("/data/general/npcs/canine.lua") +load("/data/general/npcs/snake.lua") +load("/data/general/npcs/swarm.lua") +load("/data/general/npcs/plant.lua") +load("/data/general/npcs/ant.lua") + +local Talents = require("engine.interface.ActorTalents") + +-- The boss of trollshaws, no "rarity" field means it will not be randomly generated +newEntity{ define_as = "OLD_MAN_WILLOW", + type = "giant", subtype = "huorn", unique = true, + name = "Old Man Willow", + display = "#", color=colors.OLIVE_DRAB, + desc = [[The ancient grey willow tree, ruler of the Old Forest. He despises + trespassers in his territory. "...a huge willow-tree, old and hoary + Enormous it looked, its sprawling branches going up like racing arms + with may long-fingered hands, its knotted and twisted trunk gaping in + wide fissures that creaked faintly as the boughs moved."]], + level_range = {12, 35}, exp_worth = 2, + max_life = 200, life_rating = 17, fixed_rating = true, + max_stamina = 85, + max_mana = 200, + stats = { str=25, dex=10, cun=8, mag=20, wil=20, con=20 }, + rank = 4, + size_category = 5, + infravision = 20, + move_others=true, + + resists = { [DamageType.FIRE] = -50 }, + + body = { INVEN = 10, MAINHAND=1, OFFHAND=1, BODY=1 }, + equipment = resolvers.equip{ {type="armor", subtype="shield", defined="OLD_MAN_WILLOW_SHIELD", autoreq=true}, }, + drops = resolvers.drops{chance=100, nb=5, {ego_chance=100} }, + + resolvers.talents{ + [Talents.T_STAMINA_POOL]=1, [Talents.T_STUN]=2, + + [Talents.T_MANA_POOL]=1, + [Talents.T_ICE_STORM]=1, + [Talents.T_TIDAL_WAVE]=1, + [Talents.T_FREEZE]=2, + }, + + autolevel = "caster", + ai = "dumb_talented_simple", ai_state = { talent_in=3, ai_move="move_astar", }, + + on_die = function(self, who) + game.player:resolveSource():grantQuest("starter-zones") + game.player:resolveSource():setQuestStatus("starter-zones", engine.Quest.COMPLETED, "old-forest") + end, +} diff --git a/game/modules/tome/data/zones/tutorial/objects.lua b/game/modules/tome/data/zones/tutorial/objects.lua new file mode 100644 index 0000000000000000000000000000000000000000..4298b48fb59105f4f2b71da4bc7463aeb7a1b150 --- /dev/null +++ b/game/modules/tome/data/zones/tutorial/objects.lua @@ -0,0 +1,46 @@ +-- ToME - Tales of Middle-Earth +-- Copyright (C) 2009, 2010 Nicolas Casalini +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org + +load("/data/general/objects/objects.lua") + +-- Artifact, droped (and used!) by Bill the Stone Troll + +newEntity{ base = "BASE_SHIELD", + define_as = "OLD_MAN_WILLOW_SHIELD", + name = "Old Man's Willow Barkwood", unique=true, + desc = [[The barkwood of the Old Man's Willow, made into roughtly the shape of a shield.]], + require = { stat = { str=25 }, }, + cost = 20, + + special_combat = { + dam = resolvers.rngavg(20,30), + physcrit = 2, + dammod = {str=1.5}, + }, + wielder = { + combat_armor = 5, + combat_def = 9, + fatigue = 14, + resists = { + [DamageType.FIRE] = -20, + [DamageType.COLD] = 20, + [DamageType.NATURE] = 20, + }, + }, +} diff --git a/game/modules/tome/data/zones/tutorial/traps.lua b/game/modules/tome/data/zones/tutorial/traps.lua new file mode 100644 index 0000000000000000000000000000000000000000..1c7366dd712b84eb16b65ca892988183984faff4 --- /dev/null +++ b/game/modules/tome/data/zones/tutorial/traps.lua @@ -0,0 +1,20 @@ +-- ToME - Tales of Middle-Earth +-- Copyright (C) 2009, 2010 Nicolas Casalini +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org + +load("/data/general/traps/natural_forest.lua") diff --git a/game/modules/tome/data/zones/tutorial/zone.lua b/game/modules/tome/data/zones/tutorial/zone.lua new file mode 100644 index 0000000000000000000000000000000000000000..b0e8cbab693bfe55777599270144e143bb75752b --- /dev/null +++ b/game/modules/tome/data/zones/tutorial/zone.lua @@ -0,0 +1,66 @@ +-- ToME - Tales of Middle-Earth +-- Copyright (C) 2009, 2010 Nicolas Casalini +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org + +return { + name = "Tutorial", + level_range = {1, 1}, + level_scheme = "player", + max_level = 6, + decay = {300, 800}, + actor_adjust_level = function(zone, level, e) return zone.base_level + e:getRankLevelAdjust() end, + width = 50, height = 50, +-- all_remembered = true, + all_lited = true, + persistant = "zone", + ambiant_music = "Woods of Eremae.ogg", + generator = { + map = { + class = "engine.generator.map.Roomer", + nb_rooms = 10, + edge_entrances = {6,4}, + rooms = {"forest_clearing"}, + ['.'] = "GRASS", + ['#'] = {"TREE","TREE2","TREE3","TREE4","TREE5","TREE6","TREE7","TREE8","TREE9","TREE10","TREE11","TREE12","TREE13","TREE14","TREE15","TREE16","TREE17","TREE18","TREE19","TREE20",}, + up = "UP", + down = "DOWN", + door = "GRASS1", + }, + actor = { + class = "engine.generator.actor.Random", + nb_npc = {20, 30}, + guardian = "LONE_WOLF", + }, + object = { + class = "engine.generator.object.Random", + nb_object = {6, 9}, + }, + trap = { + class = "engine.generator.trap.Random", + nb_trap = {5, 8}, + }, + }, + levels = + { + [1] = { + generator = { map = { + up = "UP_WILDERNESS", + }, }, + }, + }, +}