1 /**********************************************************************************
2 * Copyright (c) 2008, 2009 Derek Yu and Mossmouth, LLC
3 * Copyright (c) 2010, Moloch
4 * Copyright (c) 2018, Ketmar Dark
6 * This file is part of Spelunky.
8 * You can redistribute and/or modify Spelunky, including its source code, under
9 * the terms of the Spelunky User License.
11 * Spelunky is distributed in the hope that it will be entertaining and useful,
12 * but WITHOUT WARRANTY. Please see the Spelunky User License for more details.
14 * The Spelunky User License should be available in "Game Information", which
15 * can be found in the Resource Explorer, or as an external file called COPYING.
16 * If not, please obtain a new copy of Spelunky from <http://spelunkyworld.com/>
18 **********************************************************************************/
19 class ObjTikiCurse : MapObject abstract;
22 bool monkey; // if trap was triggered by a monkey
25 // if not stolen, then it is activated by monkey
26 void activate (bool stolen) {
38 // ////////////////////////////////////////////////////////////////////////// //
39 class ObjTikiCurseBoulder['oTikiCurseTriggerBoulder'] : ObjTikiCurse;
45 override bool initialize () {
46 if (!::initialize()) return false;
51 override void activate (bool stolen) {
52 if (activated) return;
57 writeln("*** Boulder Trap Activated ***");
61 override void thinkFrame () {
63 if (--boulderSpawnTime == 0) {
64 auto headTile = MapTileGiantTikiHead(level.findNearestTile(ix, iy, delegate bool (MapTile t) { return (t isa MapTileGiantTikiHead); }));
67 auto obj = ObjBoulder(level.MakeMapTile(headTile.ix/16, headTile.iy/16, 'oBoulder'));
68 if (obj) obj.monkey = monkey;
69 playSound('sndThump');
76 override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) {
81 boulderSpawnTime = 100;
85 // ////////////////////////////////////////////////////////////////////////// //
86 class ObjTikiCurseRemoveBricks['oTikiCurseRemoveBricks'] : ObjTikiCurse;
89 override bool initialize () {
90 if (!::initialize()) return false;
95 override void activate (bool stolen) {
96 if (activated) return;
104 override void thinkFrame () {
105 if (!monkey && global.cemetary && !level.ghostSpawned) {
109 //FIXME: rewrite this for several idols (???)
110 level.forEachTile(delegate bool (MapTile t) {
111 auto tt = MapTileLushTrapBlock(t);
112 if (tt) tt.activate();
114 }, castClass:MapTileLushTrapBlock);
116 // it has no reason to live anymore
121 override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) {
129 // ////////////////////////////////////////////////////////////////////////// //
130 class ObjTikiCurseCilingTrap['oTikiCurseCeilingTrap'] : ObjTikiCurse;
133 override bool initialize () {
134 if (!::initialize()) return false;
139 override void activate (bool stolen) {
140 if (activated) return;
148 override void thinkFrame () {
149 //FIXME: rewrite this for several idols (???)
150 level.forEachTile(delegate bool (MapTile t) {
151 auto tt = MapTileCeilingTrap(t);
152 if (!tt) return false;
154 if (tt.distanceToEntityCenter(level.player) < 90) {
162 }, castClass:MapTileCeilingTrap);
166 // it has no reason to live anymore
171 override void drawWithOfs (int xpos, int ypos, int scale, float currFrameDelta) {