Revision: a1a525ceaf6d
Author: Kevin Wells <
DarkOp...@gmail.com>
Date: Wed Apr 20 05:54:06 2011
Log: Monsters can now spawn during play. Added dark spawning monsters.
http://code.google.com/p/escape-from-the-masters-lair/source/detail?r=a1a525ceaf6d
Modified:
/Development/Ideas.rtf
/Escape from the Master's Lair.layout
/creature.cpp
/creature.h
/creature_combat.cpp
/data/templates/races
/dungeon_generation.cpp
/enumerations.h
/game.cpp
/game.h
/main.cpp
/monster.cpp
/player.cpp
/player_scores.cpp
/player_start.cpp
/player_windows.cpp
/race.cpp
/race.h
/save_load.cpp
/templates.cpp
/update.cpp
/version.h
=======================================
--- /Development/Ideas.rtf Wed Apr 20 03:13:44 2011
+++ /Development/Ideas.rtf Wed Apr 20 05:54:06 2011
@@ -1,7 +1,8 @@
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0
Calibri;}}
-{\*\generator Msftedit
5.41.21.2510;}\viewkind4\uc1\pard\sa200\sl276\slmult1\lang9\f0\fs22 The
darkness should be more dangerous than simply not allowing the player to
see far, though. Perhaps some enemies can only move in the darkness.
Others could only spawn in the darkness. Maybe some kind of zergling type
creature (small and weak, but lots can spawn) that only spawns in the dark
near the player.\par
-I need to add monsters spawning over time. Also, dark-spawning
monsters.\par
-Maybe monsters initially spawned on a level should be determined by the
dungeon level, but monsters spawned later on a given level are determined
by the player's current experience level.\par
+{\*\generator Msftedit
5.41.21.2510;}\viewkind4\uc1\pard\sa200\sl276\slmult1\lang9\strike\f0\fs22
The darkness should be more dangerous than simply not allowing the player
to see far, though. Perhaps some enemies can only move in the darkness.
Others could only spawn in the darkness. Maybe some kind of zergling type
creature (small and weak, but lots can spawn) that only spawns in the dark
near the player.\strike0\par
+\strike I need to add monsters spawning over time. Also, dark-spawning
monsters.\strike0\par
+\strike Maybe monsters initially spawned on a level should be determined
by the dungeon level, but monsters spawned later on a given level are
determined by the player's current experience level.\strike0\par
I think I should add a special new equipment slot for a launcher item. It
could work similarly to armor, in that ONLY launcher items can go in it.
This way, you could have a launcher item equipped while also dual-wielding
or single-wielding decent melee items. Right now, if you want melee and
ranged attacks ready, you have to have a melee and launcher item equipped
in the hand slots. But, this means that the launcher weapon is figured into
melee attacks.\par
+\strike At higher levels, monsters could spawn with their items from their
race template. At lower levels, the items would be ignored.\strike0\par
}
=======================================
--- /Escape from the Master's Lair.layout Wed Apr 20 03:13:44 2011
+++ /Escape from the Master's Lair.layout Wed Apr 20 05:54:06 2011
@@ -38,10 +38,10 @@
<Cursor1 position="325" topLine="0" />
</File>
<File name="creature.cpp" open="0" top="0" tabpos="4" split="0"
active="1" splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="3107" topLine="43" />
+ <Cursor1 position="14917" topLine="435" />
</File>
<File name="creature.h" open="0" top="0" tabpos="4" split="0" active="1"
splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="10091" topLine="285" />
+ <Cursor1 position="4003" topLine="139" />
</File>
<File name="creature_alchemy.cpp" open="0" top="0" tabpos="0" split="0"
active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor1 position="3400" topLine="48" />
@@ -50,7 +50,7 @@
<Cursor1 position="1460" topLine="36" />
</File>
<File name="creature_combat.cpp" open="0" top="0" tabpos="3" split="0"
active="1" splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="4878" topLine="51" />
+ <Cursor1 position="20453" topLine="425" />
</File>
<File name="creature_commands.cpp" open="0" top="0" tabpos="4" split="0"
active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor1 position="10188" topLine="295" />
@@ -59,10 +59,10 @@
<Cursor1 position="1143" topLine="174" />
</File>
<File name="creature_experience.cpp" open="0" top="0" tabpos="1"
split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="3573" topLine="79" />
+ <Cursor1 position="4409" topLine="24" />
</File>
<File name="creature_other_stats.cpp" open="0" top="0" tabpos="4"
split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="4016" topLine="123" />
+ <Cursor1 position="199" topLine="6" />
</File>
<File name="creature_save_load.cpp" open="0" top="0" tabpos="0" split="0"
active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor1 position="1018" topLine="18" />
@@ -74,10 +74,10 @@
<Cursor1 position="198" topLine="0" />
</File>
<File name="dungeon_generation.cpp" open="0" top="0" tabpos="6" split="0"
active="1" splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="30466" topLine="784" />
+ <Cursor1 position="32908" topLine="844" />
</File>
<File name="dungeon_location.cpp" open="0" top="0" tabpos="0" split="0"
active="1" splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="235" topLine="0" />
+ <Cursor1 position="185" topLine="0" />
</File>
<File name="dungeon_location.h" open="0" top="0" tabpos="0" split="0"
active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor1 position="147" topLine="0" />
@@ -89,7 +89,7 @@
<Cursor1 position="132" topLine="0" />
</File>
<File name="enumerations.h" open="0" top="0" tabpos="2" split="0"
active="1" splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="5639" topLine="333" />
+ <Cursor1 position="1555" topLine="46" />
</File>
<File name="font.cpp" open="0" top="0" tabpos="5" split="0" active="1"
splitpos="0" zoom_1="0" zoom_2="0">
<Cursor1 position="1745" topLine="48" />
@@ -104,10 +104,10 @@
<Cursor1 position="818" topLine="29" />
</File>
<File name="game.cpp" open="0" top="0" tabpos="3" split="0" active="1"
splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="1930" topLine="78" />
+ <Cursor1 position="454" topLine="6" />
</File>
<File name="game.h" open="0" top="0" tabpos="4" split="0" active="1"
splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="1777" topLine="60" />
+ <Cursor1 position="724" topLine="33" />
</File>
<File name="game_window.cpp" open="0" top="0" tabpos="2" split="0"
active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor1 position="3456" topLine="96" />
@@ -170,7 +170,7 @@
<Cursor1 position="132" topLine="0" />
</File>
<File name="main.cpp" open="0" top="0" tabpos="1" split="0" active="1"
splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="4402" topLine="80" />
+ <Cursor1 position="4540" topLine="86" />
</File>
<File name="main.h" open="0" top="0" tabpos="0" split="0" active="1"
splitpos="0" zoom_1="0" zoom_2="0">
<Cursor1 position="198" topLine="0" />
@@ -191,10 +191,10 @@
<Cursor1 position="255" topLine="0" />
</File>
<File name="monster.cpp" open="0" top="0" tabpos="3" split="0" active="1"
splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="4120" topLine="396" />
+ <Cursor1 position="911" topLine="24" />
</File>
<File name="monster.h" open="0" top="0" tabpos="3" split="0" active="1"
splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="1103" topLine="27" />
+ <Cursor1 position="574" topLine="21" />
</File>
<File name="monster_ai.cpp" open="0" top="0" tabpos="2" split="0"
active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor1 position="985" topLine="96" />
@@ -215,19 +215,19 @@
<Cursor1 position="132" topLine="0" />
</File>
<File name="player.cpp" open="0" top="0" tabpos="6" split="0" active="1"
splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="1830" topLine="65" />
+ <Cursor1 position="37275" topLine="854" />
</File>
<File name="player.h" open="0" top="0" tabpos="7" split="0" active="1"
splitpos="0" zoom_1="0" zoom_2="0">
<Cursor1 position="2128" topLine="76" />
</File>
<File name="player_scores.cpp" open="0" top="0" tabpos="5" split="0"
active="1" splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="6880" topLine="222" />
+ <Cursor1 position="8979" topLine="168" />
</File>
<File name="player_start.cpp" open="0" top="0" tabpos="1" split="0"
active="1" splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="6914" topLine="217" />
+ <Cursor1 position="3228" topLine="96" />
</File>
<File name="player_windows.cpp" open="0" top="0" tabpos="1" split="0"
active="1" splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="49121" topLine="1296" />
+ <Cursor1 position="50115" topLine="1313" />
</File>
<File name="quit.cpp" open="0" top="0" tabpos="0" split="0" active="1"
splitpos="0" zoom_1="0" zoom_2="0">
<Cursor1 position="963" topLine="21" />
@@ -236,10 +236,10 @@
<Cursor1 position="132" topLine="0" />
</File>
<File name="race.cpp" open="0" top="0" tabpos="2" split="0" active="1"
splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="362" topLine="0" />
+ <Cursor1 position="387" topLine="1" />
</File>
<File name="race.h" open="0" top="0" tabpos="3" split="0" active="1"
splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="678" topLine="3" />
+ <Cursor1 position="833" topLine="15" />
</File>
<File name="random_chance.cpp" open="0" top="0" tabpos="2" split="0"
active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor1 position="2427" topLine="76" />
@@ -260,7 +260,7 @@
<Cursor1 position="454" topLine="16" />
</File>
<File name="save_load.cpp" open="0" top="0" tabpos="9" split="0"
active="1" splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="1774" topLine="55" />
+ <Cursor1 position="1604" topLine="54" />
</File>
<File name="save_load.h" open="0" top="0" tabpos="4" split="0" active="1"
splitpos="0" zoom_1="0" zoom_2="0">
<Cursor1 position="204" topLine="0" />
@@ -275,7 +275,7 @@
<Cursor1 position="242" topLine="0" />
</File>
<File name="templates.cpp" open="0" top="0" tabpos="2" split="0"
active="1" splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="2212" topLine="35" />
+ <Cursor1 position="20815" topLine="108" />
</File>
<File name="templates.h" open="0" top="0" tabpos="1" split="0" active="1"
splitpos="0" zoom_1="0" zoom_2="0">
<Cursor1 position="2465" topLine="70" />
@@ -305,10 +305,10 @@
<Cursor1 position="132" topLine="0" />
</File>
<File name="update.cpp" open="0" top="0" tabpos="2" split="0" active="1"
splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="13459" topLine="297" />
+ <Cursor1 position="4268" topLine="108" />
</File>
<File name="update.h" open="0" top="0" tabpos="11" split="0" active="1"
splitpos="0" zoom_1="0" zoom_2="0">
- <Cursor1 position="249" topLine="0" />
+ <Cursor1 position="245" topLine="0" />
</File>
<File name="version.h" open="0" top="0" tabpos="0" split="0" active="1"
splitpos="0" zoom_1="0" zoom_2="0">
<Cursor1 position="369" topLine="0" />
=======================================
--- /creature.cpp Tue Apr 19 21:47:52 2011
+++ /creature.cpp Wed Apr 20 05:54:06 2011
@@ -262,6 +262,19 @@
return -1;
}
+
+bool Creature::has_light(){
+ bool light=false;
+
+ for(int i=0;i<inventory.size();i++){
+ if(inventory[i].light_on){
+ light=true;
+ break;
+ }
+ }
+
+ return light;
+}
item_template_data Creature::return_item_template(string item_name){
item_template_data item_template;
@@ -424,6 +437,17 @@
health=health_max;
}
}
+
+ //If the creature is a dark spawn, and its current tile is a lit tile.
+ if(templates.template_races[race].dark_spawn &&
(vector_levels[current_level].fog[x][y]>FOG_REVEALED_TEMPORARY ||
has_light())){
+ health-=return_health()/1.5;
+ health-=2;
+
+ if(return_health()<=0){
+ //The creature dies by burning up in the light.
+ die(CAUSE_OF_DEATH_BURNED_BY_LIGHT);
+ }
+ }
}
void Creature::process_move(){
=======================================
--- /creature.h Mon Apr 18 18:50:18 2011
+++ /creature.h Wed Apr 20 05:54:06 2011
@@ -208,6 +208,10 @@
//Returns an inventory letter to the list.
void return_inventory_letter(char returning_letter);
+ //Returns true if the creature is currently holding at least one lit
item.
+ //Returns false if the creature is not holding any lit items.
+ bool has_light();
+
//Check to see if a command can be done.
//If so, queue it for the next call to move().
//If not, handle it appropriately.
=======================================
--- /creature_combat.cpp Wed Apr 20 02:37:11 2011
+++ /creature_combat.cpp Wed Apr 20 05:54:06 2011
@@ -423,6 +423,9 @@
else if(cause_of_death==CAUSE_OF_DEATH_DROWN){
message="You sink beneath the waves... Press [Spacebar] to
continue.";
}
+ else if(cause_of_death==CAUSE_OF_DEATH_BURNED_BY_LIGHT){
+ message="You burn away into nothing in the blinding light...
Press [Spacebar] to continue.";
+ }
else{
message="You die... Press [Spacebar] to continue.";
}
@@ -466,6 +469,11 @@
message+=return_full_name();
message+=" drowns!";
}
+ else if(cause_of_death==CAUSE_OF_DEATH_BURNED_BY_LIGHT){
+ message="The ";
+ message+=return_full_name();
+ message+=" burns up in the light!";
+ }
}
update_text_log(message.c_str(),true);
=======================================
--- /data/templates/races Tue Apr 19 12:07:59 2011
+++ /data/templates/races Wed Apr 20 05:54:06 2011
@@ -637,3 +637,37 @@
flees:1
</ai traits>
</race>
+
+<race>
+ name:dark spawn
+ <DARK SPAWN>
+ description:Dark spawn spawn in the dark.
+ appearance:D
+ color:indigo
+ weight:0.07
+ strength:1
+ damage melee:3,6
+ levelup hp range:-1,-2
+ health:-40
+ speed:150
+ movement speed:1
+ agility:-2
+ hardiness:-2
+</race>
+
+<race>
+ name:grue
+ <DARK SPAWN>
+ description:When it is dark, adventurers are likely to be eaten by a grue.
+ appearance:D
+ color:dark blue
+ weight:0.07
+ strength:2
+ damage melee:3,6
+ levelup hp range:-1,-2
+ health:-45
+ speed:150
+ movement speed:1
+ agility:-2
+ hardiness:-2
+</race>
=======================================
--- /dungeon_generation.cpp Tue Apr 19 21:47:52 2011
+++ /dungeon_generation.cpp Wed Apr 20 05:54:06 2011
@@ -786,7 +786,6 @@
}
//If the tile at the random position is an appropriate tile for an
item.
- ///It should also check to make sure there is not more than one
other item within a small radius.
if(generated_tiles[x][y].type==TILE_TYPE_FLOOR){
//Generate the item.
generated_items.push_back(Item());
@@ -841,12 +840,11 @@
y=random_range(0,generated_level_y-1);
//Randomly select a race from the races template.
- ///For now, equal chance of all races.
int
random_race_template=random_range(0,templates.template_races.size()-1);
//If the tile at the random position is an appropriate tile for a
monster.
- ///It should also check to make sure there is not more than one
other monster within a small radius.
- if(generated_tiles[x][y].type==TILE_TYPE_FLOOR){
+ if(generated_tiles[x][y].type==TILE_TYPE_FLOOR &&
+ (!templates.template_races[random_race_template].dark_spawn ||
(templates.template_races[random_race_template].dark_spawn &&
generated_fog[x][y]<=FOG_FOG))){
//Generate the monster.
generated_monsters.push_back(Monster());
=======================================
--- /enumerations.h Mon Apr 18 18:50:18 2011
+++ /enumerations.h Wed Apr 20 05:54:06 2011
@@ -100,8 +100,8 @@
enum{
FOG_BLACK,
FOG_FOG,
- FOG_REVEALED_PERMANENT,
FOG_REVEALED_TEMPORARY,
+ FOG_REVEALED_PERMANENT,
FOG_PERMANENT
};
@@ -252,8 +252,8 @@
//******************//
enum{
- HEALING_SLIGHT_MIN=5,
- HEALING_SLIGHT_MAX=20,
+ HEALING_SLIGHT_MIN=15,
+ HEALING_SLIGHT_MAX=25,
HEALING_MIN=50,
HEALING_MAX=200,
HEALING_CONSIDERABLE_MIN=500,
@@ -396,6 +396,7 @@
CAUSE_OF_DEATH_THIRST,
CAUSE_OF_DEATH_LAVA,
CAUSE_OF_DEATH_DROWN,
+ CAUSE_OF_DEATH_BURNED_BY_LIGHT,
CAUSE_OF_DEATH_NONE
};
=======================================
--- /game.cpp Sun Apr 17 01:59:21 2011
+++ /game.cpp Wed Apr 20 05:54:06 2011
@@ -17,6 +17,8 @@
using namespace boost;
Game::Game(){
+ turn=0;
+
generated_level_x=0;
generated_level_y=0;
=======================================
--- /game.h Sat Apr 16 07:21:30 2011
+++ /game.h Wed Apr 20 05:54:06 2011
@@ -42,6 +42,9 @@
public:
+ //The current world-wide turn.
+ int turn;
+
//Available identifiers for objects.
//0 is reserved to mean "no identifier assigned."
std::vector< std::vector<uint32_t> > identifiers;
=======================================
--- /main.cpp Mon Apr 18 18:50:18 2011
+++ /main.cpp Wed Apr 20 05:54:06 2011
@@ -97,7 +97,6 @@
if(player.alive && player.initiate_turn){
player.initiate_turn=false;
turn();
- player.turn++;
}
//Once everything has had its chance to move, we handle
events (collision detection).
=======================================
--- /monster.cpp Tue Apr 19 01:14:25 2011
+++ /monster.cpp Wed Apr 20 05:54:06 2011
@@ -9,13 +9,14 @@
#include "render.h"
#include "dungeon.h"
#include "covering_conversions.h"
+#include "starting_values.h"
using namespace std;
void Monster::set_inventory(){
//Add some random gold.
if(random_range(0,99)<50){
- give_item("gold piece",random_range(1,10));
+ give_item("gold piece",random_range(1,experience_level*10.0));
}
//Add some random bottles of water.
@@ -25,7 +26,7 @@
//Give the monster any race-specific items.
for(int
i=0;i<templates.template_races[race].inventory_items.size();i++){
- if(random_range(0,99)<45){
+ if(random_range(0,99)<experience_level){
give_item(templates.template_races[race].inventory_items[i]);
//If the new item is armor.
@@ -68,20 +69,20 @@
// From creature: //
-
health_max=random_range(templates.base_stats.health_max/2.0,templates.base_stats.health_max);
+ health_max=templates.base_stats.health_max;
health=health_max;
-
mana_max=random_range(templates.base_stats.mana_max/2.0,templates.base_stats.mana_max);
+ mana_max=templates.base_stats.mana_max;
mana=mana_max;
-
base_damage_melee_min=random_range(templates.base_stats.base_damage_melee_min/2.0,templates.base_stats.base_damage_melee_min);
-
base_damage_melee_max=random_range(templates.base_stats.base_damage_melee_max/2.0,templates.base_stats.base_damage_melee_max);
-
-
base_damage_ranged_min=random_range(templates.base_stats.base_damage_ranged_min/2.0,templates.base_stats.base_damage_ranged_min);
-
base_damage_ranged_max=random_range(templates.base_stats.base_damage_ranged_max/2.0,templates.base_stats.base_damage_ranged_max);
-
-
base_damage_thrown_min=random_range(templates.base_stats.base_damage_thrown_min/2.0,templates.base_stats.base_damage_thrown_min);
-
base_damage_thrown_max=random_range(templates.base_stats.base_damage_thrown_max/2.0,templates.base_stats.base_damage_thrown_max);
+ base_damage_melee_min=templates.base_stats.base_damage_melee_min;
+ base_damage_melee_max=templates.base_stats.base_damage_melee_max;
+
+ base_damage_ranged_min=templates.base_stats.base_damage_ranged_min;
+ base_damage_ranged_max=templates.base_stats.base_damage_ranged_max;
+
+ base_damage_thrown_min=templates.base_stats.base_damage_thrown_min;
+ base_damage_thrown_max=templates.base_stats.base_damage_thrown_max;
movement_speed=templates.base_stats.movement_speed;
next_move=movement_speed;
@@ -93,20 +94,36 @@
}
//Set the monster's focused skills.
- for(int i=0;i<3;){
- //Choose a random skill.
- ///short
random_skill=random_range(SKILL_BLADED_WEAPONS,SKILL_MAGIC_SUMMONING);
- ///Disable some skills.
- short random_skill=random_range(SKILL_BLADED_WEAPONS,SKILL_ARMOR);
- while(random_skill==SKILL_SECURITY || random_skill==SKILL_STEALTH |
| random_skill==SKILL_FIGHTING || random_skill==SKILL_DODGING){
- random_skill=random_range(SKILL_BLADED_WEAPONS,SKILL_ARMOR);
- }
- ///
-
- //If the random skill is different from all of the focused skills.
- if(random_skill!=focused_skills[0] &&
random_skill!=focused_skills[1] && random_skill!=focused_skills[2]){
- focused_skills[i]=random_skill;
- i++;
+
+ //If the monster has an affiinity for one or more skills, choose those
first.
+ for(int i=SKILL_BLADED_WEAPONS;i<SKILL_MAGIC_SUMMONING+1;i++){
+ //If the player has less than the standard max experience for this
skill, he has a natural affinity for it.
+ if(skills[i][SKILL_EXPERIENCE_MAX]<STARTING_SKILL_EXPERIENCE_MAX){
+ for(int n=0;n<3;n++){
+ if(focused_skills[n]==-1){
+ focused_skills[n]=i;
+ break;
+ }
+ }
+ }
+ }
+
+ for(int n=0;n<3;n++){
+ if(focused_skills[n]==-1){
+ focused_skills[n]=SKILL_ARMOR;
+ break;
+ }
+ }
+ for(int n=0;n<3;n++){
+ if(focused_skills[n]==-1){
+ focused_skills[n]=SKILL_SPEED;
+ break;
+ }
+ }
+ for(int n=0;n<3;n++){
+ if(focused_skills[n]==-1){
+ focused_skills[n]=SKILL_BLADED_WEAPONS;
+ break;
}
}
=======================================
--- /player.cpp Tue Apr 19 12:07:59 2011
+++ /player.cpp Wed Apr 20 05:54:06 2011
@@ -209,7 +209,7 @@
void Player::set_base_stats(){
// From creature: //
- health_max=templates.base_stats.health_max;
+ health_max=templates.base_stats.health_max*2.0;
health=health_max;
mana_max=templates.base_stats.mana_max;
=======================================
--- /player_scores.cpp Mon Apr 18 02:59:47 2011
+++ /player_scores.cpp Wed Apr 20 05:54:06 2011
@@ -287,6 +287,9 @@
else if(cause_of_death==CAUSE_OF_DEATH_DROWN){
death_message="Drowned.";
}
+ else if(cause_of_death==CAUSE_OF_DEATH_BURNED_BY_LIGHT){
+ death_message="Burned up in the light.";
+ }
//If the player died.
if(cause_of_death!=CAUSE_OF_DEATH_NONE){
=======================================
--- /player_start.cpp Wed Apr 20 02:37:11 2011
+++ /player_start.cpp Wed Apr 20 05:54:06 2011
@@ -102,7 +102,7 @@
string new_race="";
if(random==0){
- new_race="human";
+ new_race="high elf";
}
else if(random==1){
new_race="dwarf";
=======================================
--- /player_windows.cpp Wed Apr 20 02:37:11 2011
+++ /player_windows.cpp Wed Apr 20 05:54:06 2011
@@ -143,6 +143,22 @@
get_race.clear();
}
+
+ else if(event.key.keysym.unicode==(Uint16)'*'){
+ game_start_random_race();
+ }
+
+ else if(event.key.keysym.unicode==(Uint16)'!'){
+ game_start_random_all();
+ }
+
+ else if(event.key.keysym.unicode==(Uint16)'-'){
+ game_start_good_race();
+ }
+
+ else if(event.key.keysym.unicode==(Uint16)'='){
+ game_start_good_all();
+ }
else if(event.key.keysym.sym==SDLK_BACKSPACE && get_race.length()>0){
//Remove one character from the end of the string.
@@ -159,22 +175,6 @@
keystates[SDLK_RETURN]=NULL;
keystates[SDLK_KP_ENTER]=NULL;
}
-
- else if(event.key.keysym.unicode==(Uint16)'*'){
- game_start_random_race();
- }
-
- else if(event.key.keysym.unicode==(Uint16)'!'){
- game_start_random_all();
- }
-
- else if(event.key.keysym.unicode==(Uint16)'p'){
- game_start_good_race();
- }
-
- else if(event.key.keysym.unicode==(Uint16)'g'){
- game_start_good_all();
- }
}
void Player::handle_input_get_focused_skills(){
@@ -188,6 +188,22 @@
focused_skills[2]=-1;
done_focusing_skills=false;
}
+
+ else if(event.key.keysym.unicode==(Uint16)'*'){
+ game_start_random_skills();
+ }
+
+ else if(event.key.keysym.unicode==(Uint16)'!'){
+ game_start_random_all();
+ }
+
+ else if(event.key.keysym.unicode==(Uint16)'-'){
+ game_start_good_skills();
+ }
+
+ else if(event.key.keysym.unicode==(Uint16)'='){
+ game_start_good_all();
+ }
else if(event.key.keysym.unicode>=(Uint16)'a' &&
event.key.keysym.unicode<=(Uint16)'u'){
short skill=-1;
@@ -292,22 +308,6 @@
keystates[SDLK_RETURN]=NULL;
keystates[SDLK_KP_ENTER]=NULL;
}
-
- else if(event.key.keysym.unicode==(Uint16)'*'){
- game_start_random_skills();
- }
-
- else if(event.key.keysym.unicode==(Uint16)'!'){
- game_start_random_all();
- }
-
- else if(event.key.keysym.unicode==(Uint16)'p'){
- game_start_good_skills();
- }
-
- else if(event.key.keysym.unicode==(Uint16)'g'){
- game_start_good_all();
- }
}
void Player::handle_input_get_starting_items(){
@@ -322,6 +322,22 @@
starting_items.clear();
done_buying_start_items=false;
}
+
+ else if(event.key.keysym.unicode==(Uint16)'*'){
+ game_start_random_items();
+ }
+
+ else if(event.key.keysym.unicode==(Uint16)'!'){
+ game_start_random_all();
+ }
+
+ else if(event.key.keysym.unicode==(Uint16)'-'){
+ game_start_good_items();
+ }
+
+ else if(event.key.keysym.unicode==(Uint16)'='){
+ game_start_good_all();
+ }
else if((event.key.keysym.unicode>=(Uint16)'a' &&
event.key.keysym.unicode<=(Uint16)'z') ||
(event.key.keysym.unicode>=(Uint16)'A' &&
event.key.keysym.unicode<=(Uint16)'Z')){
//Look through the items available for purchase.
@@ -400,22 +416,6 @@
keystates[SDLK_RETURN]=NULL;
keystates[SDLK_KP_ENTER]=NULL;
}
-
- else if(event.key.keysym.unicode==(Uint16)'*'){
- game_start_random_items();
- }
-
- else if(event.key.keysym.unicode==(Uint16)'!'){
- game_start_random_all();
- }
-
- else if(event.key.keysym.unicode==(Uint16)'p'){
- game_start_good_items();
- }
-
- else if(event.key.keysym.unicode==(Uint16)'g'){
- game_start_good_all();
- }
}
void Player::handle_input_start_message(){
@@ -715,9 +715,9 @@
}
}
- ss.clear();ss.str("");ss<<"[p] - Pick a good race for me [*]
- Randomly choose a race";msg=ss.str();
+ ss.clear();ss.str("");ss<<"[-] - Pick a good race for me [*]
- Randomly choose a race";msg=ss.str();
font_small.show((option_screen_width-msg.length()*font_small.spacing_x)/2.0,option_screen_height-font_small.spacing_y*2,msg,COLOR_WHITE);
- ss.clear();ss.str("");ss<<"[g] - Pick a good character for me [!]
- Randomly choose a character";msg=ss.str();
+ ss.clear();ss.str("");ss<<"[=] - Pick a good character for me [!]
- Randomly choose a character";msg=ss.str();
font_small.show((option_screen_width-msg.length()*font_small.spacing_x)/2.0,option_screen_height-font_small.spacing_y,msg,COLOR_WHITE);
ss.clear();ss.str("");ss<<" <-- Press [Escape] to go
back";msg=ss.str();
@@ -950,9 +950,9 @@
font_small.show(option_screen_width-font_small.spacing_x*msg.length(),0,msg,COLOR_WHITE);
}
- ss.clear();ss.str("");ss<<"[p] - Pick a good race for me [*]
- Randomly choose a race";msg=ss.str();
+ ss.clear();ss.str("");ss<<"[-] - Pick good skills for me [*]
- Randomly choose skills";msg=ss.str();
font_small.show((option_screen_width-msg.length()*font_small.spacing_x)/2.0,option_screen_height-font_small.spacing_y*2,msg,COLOR_WHITE);
- ss.clear();ss.str("");ss<<"[g] - Pick a good character for me [!]
- Randomly choose a character";msg=ss.str();
+ ss.clear();ss.str("");ss<<"[=] - Pick a good character for me [!]
- Randomly choose a character";msg=ss.str();
font_small.show((option_screen_width-msg.length()*font_small.spacing_x)/2.0,option_screen_height-font_small.spacing_y,msg,COLOR_WHITE);
ss.clear();ss.str("");ss<<" <-- Press [Escape] to go
back";msg=ss.str();
@@ -1039,9 +1039,9 @@
ss.clear();ss.str("");ss<<"Press [Enter] to continue
--> ";msg=ss.str();
font_small.show(option_screen_width-font_small.spacing_x*msg.length(),0,msg,COLOR_WHITE);
- ss.clear();ss.str("");ss<<"[p] - Pick a good race for me [*]
- Randomly choose a race";msg=ss.str();
+ ss.clear();ss.str("");ss<<"[-] - Pick good items for me [*] -
Randomly choose items";msg=ss.str();
font_small.show((option_screen_width-msg.length()*font_small.spacing_x)/2.0,option_screen_height-font_small.spacing_y*2,msg,COLOR_WHITE);
- ss.clear();ss.str("");ss<<"[g] - Pick a good character for me [!]
- Randomly choose a character";msg=ss.str();
+ ss.clear();ss.str("");ss<<"[=] - Pick a good character for me [!]
- Randomly choose a character";msg=ss.str();
font_small.show((option_screen_width-msg.length()*font_small.spacing_x)/2.0,option_screen_height-font_small.spacing_y,msg,COLOR_WHITE);
ss.clear();ss.str("");ss<<" <-- Press [Escape] to go
back";msg=ss.str();
@@ -1323,7 +1323,14 @@
ss.clear();ss.str("");ss<<"It can
do ";ss<<inventory[item_info].damage_min_ranged;ss<<"-";ss<<inventory[item_info].damage_max_ranged;ss<<"
ranged damage.";ss<<"\xA";msg+=ss.str();
}
if(inventory[item_info].category==ITEM_ARMOR){
- ss.clear();ss.str("");ss<<"It can defend
against ";ss<<inventory[item_info].defense;ss<<" points of
damage.";ss<<"\xA";msg+=ss.str();
+ string points="";
+ if(inventory[item_info].defense==1){
+ points="point";
+ }
+ else{
+ points="points";
+ }
+ ss.clear();ss.str("");ss<<"It can defend
against ";ss<<inventory[item_info].defense;ss<<" ";ss<<points;ss<<" of
damage.";ss<<"\xA";msg+=ss.str();
}
ss.clear();ss.str("");ss<<"It is
worth ";ss<<inventory[item_info].monetary_value*inventory[item_info].stack;ss<<".";ss<<"\xA";msg+=ss.str();
=======================================
--- /race.cpp Mon Apr 18 21:25:22 2011
+++ /race.cpp Wed Apr 20 05:54:06 2011
@@ -18,6 +18,8 @@
description="";
+ dark_spawn=false;
+
ai_trait_flees=false;
ai_trait_uses_items=false;
ai_trait_wanders=true;
=======================================
--- /race.h Mon Apr 18 21:25:22 2011
+++ /race.h Wed Apr 20 05:54:06 2011
@@ -28,6 +28,10 @@
//A description of the race.
std::string description;
+ //If true, the race can only spawn in darkness.
+ //If false, the race can spawn anywhere.
+ bool dark_spawn;
+
//AI Traits:
bool ai_trait_flees;
=======================================
--- /save_load.cpp Sat Apr 16 01:26:55 2011
+++ /save_load.cpp Wed Apr 20 05:54:06 2011
@@ -54,6 +54,9 @@
save<<game.identifiers[i][n]<<"\n";
}
}
+
+ //World turn.
+ save<<game.turn<<"\n";
//Level information.
save<<current_level<<"\n";
@@ -225,6 +228,10 @@
game.identifiers[i].push_back(this_identifier);
}
}
+
+ //World turn.
+ getline(load,line);
+ game.turn=atoi(line.c_str());
//Level information.
getline(load,line);
=======================================
--- /templates.cpp Wed Apr 20 02:37:11 2011
+++ /templates.cpp Wed Apr 20 05:54:06 2011
@@ -535,6 +535,7 @@
//The data name strings used in the file.
string name="name:";
+ string dark_spawn="<DARK SPAWN>";
string prefix_article="prefix article:";
string description="description:";
string appearance="appearance:";
@@ -601,6 +602,13 @@
temp_race.name=" ";
}
}
+ //Dark spawn.
+ else if(icontains(line,dark_spawn)){
+ //Clear the data name.
+ line.erase(0,dark_spawn.length());
+
+ temp_race.dark_spawn=true;
+ }
//Prefix article.
else if(icontains(line,prefix_article)){
//Clear the data name.
=======================================
--- /update.cpp Wed Apr 20 02:37:11 2011
+++ /update.cpp Wed Apr 20 05:54:06 2011
@@ -5,6 +5,8 @@
#include "world.h"
#include "render.h"
#include "material_properties.h"
+#include "grammar.h"
+#include "message_log.h"
#include <SDL.h>
@@ -72,6 +74,89 @@
}
}
}
+
+ //Increment the player's turn count.
+ player.turn++;
+
+ //Increment the world turn count.
+ game.turn++;
+
+ int world_turn_limit=100;
+ bool player_has_light=player.has_light();
+ if(!player_has_light){
+ world_turn_limit=10;
+ }
+
+ //If enough world turns have passed.
+ if(game.turn>world_turn_limit){
+ game.turn=0;
+
+ int
monster_limit=(vector_levels[current_level].level_x*vector_levels[current_level].level_y)/250.0;
+ if(!player_has_light){
+
monster_limit=(vector_levels[current_level].level_x*vector_levels[current_level].level_y)/125.0;
+ }
+
+ //If there are not already too many monsters.
+ if(vector_levels[current_level].monsters.size()<monster_limit){
+ //Attempt to spawn a new monster.
+ for(int i=0;i<50;i++){
+ short x,y;
+ int random_race_template=-1;
+
+ if(player_has_light){
+ //Choose a random location in the level.
+
x=random_range(0,vector_levels[current_level].level_x-1);
+
y=random_range(0,vector_levels[current_level].level_y-1);
+
+ //Randomly select a race from the races template.
+
random_race_template=random_range(0,templates.template_races.size()-1);
+ }
+ else{
+ //Choose a random location near the player.
+ do{
+ x=random_range(player.x-12,player.x+12);
+ y=random_range(player.y-12,player.y+12);
+ }while(x<0 || x>vector_levels[current_level].level_x-1
|| y<0 || y>vector_levels[current_level].level_y-1);
+
+ //Select a dark spawn race.
+ do{
+
random_race_template=random_range(0,templates.template_races.size()-1);
+
}while(!templates.template_races[random_race_template].dark_spawn);
+ }
+
+ //If the tile at the random position is an appropriate
tile for a monster.
+
if(vector_levels[current_level].tiles[x][y].type==TILE_TYPE_FLOOR &&
+
(!templates.template_races[random_race_template].dark_spawn ||
(templates.template_races[random_race_template].dark_spawn &&
vector_levels[current_level].fog[x][y]<=FOG_FOG))){
+ //Generate the monster.
+
vector_levels[current_level].monsters.push_back(Monster());
+
+ //Assign an identifier to the monster.
+
vector_levels[current_level].monsters[vector_levels[current_level].monsters.size()-1].assign_identifier();
+
+ //Apply the selected template to the monster.
+
vector_levels[current_level].monsters[vector_levels[current_level].monsters.size()-1].apply_race(random_race_template);
+
+ //Set the monster's base stats.
+
vector_levels[current_level].monsters[vector_levels[current_level].monsters.size()-1].set_base_stats(player.experience_level-1);
+
+ //Set the newly generated monster's position.
+
vector_levels[current_level].monsters[vector_levels[current_level].monsters.size()-1].x=x;
+
vector_levels[current_level].monsters[vector_levels[current_level].monsters.size()-1].y=y;
+
+ //Set the monster's starting inventory.
+
vector_levels[current_level].monsters[vector_levels[current_level].monsters.size()-1].set_inventory();
+
+ msg=a_vs_an(random_race_template);
+ msg+=" ";
+
msg+=templates.template_races[random_race_template].name;
+ msg+=" spawns.";
+ update_text_log(msg.c_str(),true);
+
+ break;
+ }
+ }
+ }
+ }
}
//Handle events, such as collisions.
@@ -309,6 +394,7 @@
ss.clear();ss.str("");ss<<"Weight: ";ss<<player.weight;ss<<"\xA";msg+=ss.str();
ss.clear();ss.str("");ss<<"Armor
Weight: ";ss<<player.return_inventory_weight(ITEM_ARMOR);ss<<"\xA";msg+=ss.str();
ss.clear();ss.str("");ss<<"Movement
speed: ";ss<<player.return_movement_speed();ss<<"\xA";msg+=ss.str();
+ ss.clear();ss.str("");ss<<"Base
hp: ";ss<<player.health;ss<<"\xA";msg+=ss.str();
font_small.show(5,5,msg,COLOR_WHITE);
}
=======================================
--- /version.h Wed Apr 20 03:13:44 2011
+++ /version.h Wed Apr 20 05:54:06 2011
@@ -16,17 +16,17 @@
//Standard Version Type
static const long MAJOR = 0;
static const long MINOR = 3;
- static const long BUILD = 3000;
- static const long REVISION = 16630;
+ static const long BUILD = 3033;
+ static const long REVISION = 16817;
//Miscellaneous Version Types
- static const long BUILDS_COUNT = 7038;
- #define RC_FILEVERSION 0,3,3000,16630
- #define RC_FILEVERSION_STRING "0, 3, 3000, 16630\0"
- static const char FULLVERSION_STRING[] = "0.3.3000.16630";
+ static const long BUILDS_COUNT = 7112;
+ #define RC_FILEVERSION 0,3,3033,16817
+ #define RC_FILEVERSION_STRING "0, 3, 3033, 16817\0"
+ static const char FULLVERSION_STRING[] = "0.3.3033.16817";
//These values are to keep track of your versioning state, don't modify
them.
- static const long BUILD_HISTORY = 40;
+ static const long BUILD_HISTORY = 73;
}