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 MapTileGraveBase : MapTile;
21 array!name contentNames;
24 void generateContents () {
25 if (level.isObjectAtPoint(ix+8, iy+8, &level.cbIsObjectTreasure)) return;
26 if (global.randRoom(1, 2) == 1) contentNames[$] = 'oGoldNugget';
27 else if (global.randRoom(1, 4) == 1) contentNames[$] = 'oSapphireBig';
28 else if (global.randRoom(1, 6) == 1) contentNames[$] = 'oEmeraldBig';
29 else if (global.randRoom(1, 8) == 1) contentNames[$] = 'oRubyBig';
33 override void setupTile () {
34 switch (global.randRoom(1, 5)) {
35 case 1: spriteName = 'sGrave2'; break;
36 case 2: spriteName = 'sGrave3'; break;
37 case 3: spriteName = 'sGrave4'; break;
38 case 4: spriteName = 'sGrave5'; break;
39 case 5: spriteName = 'sGrave6'; break;
45 override bool smashMe () {
46 if (invincible) return false;
53 if (smashed) scrSprayRubble(ix, iy, 3);
54 scrDropRubble(ix, iy, 3);
56 foreach (name cname; contentNames) {
57 if (cname) level.MakeMapObject(ix+8, iy+8, cname);
59 contentNames.length = 0;
65 override void thinkFrame () {
66 if (!level.isSolidAtPoint(ix, iy+16)) { instanceRemove(); return; }
68 if (!isCollisionBottom(1)) {
69 yVel = fmin(yVel+myGrav, 0.6);
82 desc2 = "This tombstone marks the site of someone's burial.";
83 spriteName = 'sGrave';
91 // ////////////////////////////////////////////////////////////////////////// //
92 class MapTileGrave['oGrave'] : MapTileGraveBase;
98 // ////////////////////////////////////////////////////////////////////////// //
99 class MapTileAshGrave['oAshGrave'] : MapTileGraveBase;
102 override void generateContents () {
103 contentNames[$] = 'oAshShotgun';
107 override void setupTile () {
108 spriteName = 'sGraveAsh';
110 writeln("*** ASH Grave generated at (", ix/16, ",", iy/16, ")");