diff options
author | Charles Otto <ottochar@gmail.com> | 2009-10-16 15:28:00 -0400 |
---|---|---|
committer | Charles Otto <ottochar@gmail.com> | 2009-10-16 17:12:32 -0400 |
commit | 1feac7b0b1cef1cea1ab107f0cce26e3a94e84b7 (patch) | |
tree | 82c6df5370ab885099c1765abdb2f15a3bc51cca /crawl-ref | |
parent | d5c9626b31d13b7e3b180603f72b93910679ba30 (diff) | |
download | crawl-ref-1feac7b0b1cef1cea1ab107f0cce26e3a94e84b7.tar.gz crawl-ref-1feac7b0b1cef1cea1ab107f0cce26e3a94e84b7.zip |
Fix bug [2874791], Merfolk stat change issues
Fix some conditions causing permanent stat loss or gain for Mf with
stat modifying boots.
Unmerge boots when the player starts levitating or flying on a water
square.
Use move_player_to_grid in blink, semi-controlled blink, and
teleportation.
Also fix a bug where Mf could random teleport into solid walls.
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/it_use2.cc | 9 | ||||
-rw-r--r-- | crawl-ref/source/spells1.cc | 35 | ||||
-rw-r--r-- | crawl-ref/source/spells3.cc | 23 | ||||
-rw-r--r-- | crawl-ref/source/spells4.cc | 13 |
4 files changed, 53 insertions, 27 deletions
diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc index 84cdc0b4ed..5d3f4e795b 100644 --- a/crawl-ref/source/it_use2.cc +++ b/crawl-ref/source/it_use2.cc @@ -31,6 +31,8 @@ REVISION("$Rev$"); #include "spl-mis.h" #include "spl-util.h" #include "stuff.h" +#include "terrain.h" +#include "transfor.h" #include "tutorial.h" #include "view.h" #include "xom.h" @@ -243,6 +245,13 @@ bool potion_effect(potion_type pot_eff, int pow, bool drank_it, bool was_known) } } + // Merfolk boots unmeld if levitation takes us out of water + if(!player_is_airborne() && you.species == SP_MERFOLK + && grid_is_water(grd(you.pos()))) + { + unmeld_one_equip(EQ_BOOTS); + } + you.duration[DUR_LEVITATION] += 25 + random2(pow); if (you.duration[DUR_LEVITATION] > 100) diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index d480f36430..57b01695a7 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -234,19 +234,25 @@ void random_blink(bool allow_partial_control, bool override_abyss) #endif else { + // Going to assume that move_player_to_grid works, (it should + // because terrain type etc. was already checked). could result + // in awkward messaging if it cancels for some reason but it's + // probably better than getting the blink message after any Mf + // transform messages all the time -cao mpr("You blink."); - - success = true; - - // Leave a purple cloud. - place_cloud(CLOUD_PURP_SMOKE, you.pos(), 1 + random2(3), KC_YOU); - you.moveto(target); - - if (you.level_type == LEVEL_ABYSS) + coord_def origin = you.pos(); + success = move_player_to_grid(target, false, true, true); + if(success) { - abyss_teleport(false); - if (you.pet_target != MHITYOU) - you.pet_target = MHITNOT; + // Leave a purple cloud. + place_cloud(CLOUD_PURP_SMOKE, origin, 1 + random2(3), KC_YOU); + + if (you.level_type == LEVEL_ABYSS) + { + abyss_teleport(false); + if (you.pet_target != MHITYOU) + you.pet_target = MHITNOT; + } } } @@ -1438,6 +1444,13 @@ void cast_fly(int power) mpr("You swoop lightly up into the air."); else mpr("You fly up into the air."); + + // Merfolk boots unmeld if flight takes us out of water + if(you.species == SP_MERFOLK && grid_is_water(grd(you.pos()))) + { + unmeld_one_equip(EQ_BOOTS); + } + } else mpr("You feel more buoyant."); diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index 6facccd714..b6b07dcf85 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -1511,25 +1511,24 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area) if (!see_grid(pos)) large_change = true; - // Leave a purple cloud. - place_cloud(CLOUD_PURP_SMOKE, you.pos(), 1 + random2(3), KC_YOU); - - you.moveto(pos); - // Merfolk should be able to control-tele into deep water. - if (grd(you.pos()) != DNGN_FLOOR - && grd(you.pos()) != DNGN_SHALLOW_WATER + if (grd(pos) != DNGN_FLOOR + && grd(pos) != DNGN_SHALLOW_WATER && (you.species != SP_MERFOLK - || grd(you.pos()) != DNGN_DEEP_WATER) - || monster_at(you.pos()) - || env.cgrid(you.pos()) != EMPTY_CLOUD) + || grd(pos) != DNGN_DEEP_WATER) + || monster_at(pos) + || env.cgrid(pos) != EMPTY_CLOUD) { is_controlled = false; large_change = false; } else { + // Leave a purple cloud. + place_cloud(CLOUD_PURP_SMOKE, you.pos(), 1 + random2(3), KC_YOU); + // Controlling teleport contaminates the player. - bwr + move_player_to_grid(pos, false, true, true); contaminate_player(1, true); } } @@ -1574,7 +1573,7 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area) while (grd(newpos) != DNGN_FLOOR && grd(newpos) != DNGN_SHALLOW_WATER && (you.species != SP_MERFOLK - || grd(you.pos()) != DNGN_DEEP_WATER) + || grd(newpos) != DNGN_DEEP_WATER) || monster_at(newpos) || env.cgrid(newpos) != EMPTY_CLOUD || need_distance_check && (newpos - centre).abs() < 34*34); @@ -1592,7 +1591,7 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area) // Leave a purple cloud. place_cloud(CLOUD_PURP_SMOKE, you.pos(), 1 + random2(3), KC_YOU); - you.moveto(newpos); + move_player_to_grid(newpos, false, true, true); } if (large_change) diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 43966336b2..5fe91b53bd 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -1980,11 +1980,16 @@ static int _quadrant_blink(coord_def where, int pow, int, actor *) if (!found) return(0); - // Leave a purple cloud. - place_cloud(CLOUD_PURP_SMOKE, you.pos(), 1 + random2(3), KC_YOU); + coord_def origin = you.pos(); + int res = move_player_to_grid(target, false, true, true); - you.moveto(target); - return 1; + if(res) + { + // Leave a purple cloud. + place_cloud(CLOUD_PURP_SMOKE, origin, 1 + random2(3), KC_YOU); + } + + return res; } int cast_semi_controlled_blink(int pow) |