1 /**
2 Rock Bottom
3 An arena like chaotic last man standing round in a well.
4
5 @author Mimmo_O, Maikel
6 */
7
8
Initialize()9 protected func Initialize()
10 {
11 // Goal and rules.
12 CreateObject(Goal_LastManStanding, 0, 0, NO_OWNER);
13 CreateObject(Rule_KillLogs);
14 CreateObject(Rule_Gravestones);
15 GetRelaunchRule()->SetLastWeaponUse(false);
16
17 // Chests with weapons.
18 var chest = CreateObjectAbove(Chest, 108, 248);
19 chest->MakeInvincible();
20 AddEffect("IntFillChests", nil, 100, 36, nil, nil, chest);
21
22 // Objects fade after 7 seconds.
23 CreateObject(Rule_ObjectFade)->DoFadeTime(7 * 36);
24
25 // Some decoration trunks ranks and a waterfall.
26 var trunk = CreateObjectAbove(Trunk, 76, 324);
27 trunk->SetR(60); trunk.Plane = 510;
28 trunk.MeshTransformation = [-731, 0, 682, 0, 0, 1000, 0, 0, -682, 0, -731, 0];
29 trunk = CreateObjectAbove(Trunk, 123, 68);
30 trunk->SetR(115); trunk.Plane = 510;
31 trunk.MeshTransformation = [469, 0, 883, 0, 0, 1000, 0, 0, -883, 0, 469, 0];
32 trunk = CreateObjectAbove(Trunk, 172, 134);
33 trunk->SetR(-110); trunk.Plane = 510;
34 trunk.MeshTransformation = [-545, 0, -839, 0, 0, 1000, 0, 0, 839, 0, -545, 0];
35
36 var waterfall;
37 waterfall = CreateWaterfall(130, 53, 2, "Water");
38 waterfall->SetDirection(6, 3, 2, 3);
39 waterfall = CreateWaterfall(144, 50, 8, "Water");
40 waterfall->SetDirection(9, 3, 3, 3);
41 CreateLiquidDrain(100, 315, 10);
42 CreateLiquidDrain(130, 315, 10);
43 CreateLiquidDrain(160, 315, 10);
44
45 CreateObjectAbove(Fern, 48, 114);
46 CreateObjectAbove(Fern, 284, 128);
47 CreateObjectAbove(Lorry, 294, 128)->SetR(20);
48 CreateObjectAbove(Pickaxe, 260, 128)->SetR(-45);
49 CreateObjectAbove(Mushroom, 271, 136);
50
51 CreateObjectAbove(Branch, 146, 316)->SetR(180);
52 CreateObjectAbove(Branch, 192, 198)->SetR(225);
53 CreateObjectAbove(Branch, 54, 76)->SetR(180);
54 CreateObjectAbove(Branch, 50, 232)->SetR(120);
55 CreateObjectAbove(Branch, 264, 238)->SetR(-120);
56
57 for (var i = 0; i < 2 + Random(6); i++)
58 CreateObjectAbove(Branch, 121, 10 + Random(140))->SetR(RandomX(60, 120));
59 for (var i = 0; i < 2 + Random(6); i++)
60 CreateObjectAbove(Branch, 183, 10 + Random(140))->SetR(-RandomX(60, 120));
61
62 // Some lights to have the well visible at all times.
63 CreateLight(152, 40, 80, Fx_Light.LGT_Constant);
64 CreateLight(152, 120, 80, Fx_Light.LGT_Constant);
65 CreateLight(152, 200, 80, Fx_Light.LGT_Constant);
66 CreateLight(152, 340, 80, Fx_Light.LGT_Constant);
67 var torch1 = CreateObjectAbove(Torch, 60, 256);
68 torch1->AttachToWall(true);
69 var torch2 = CreateObjectAbove(Torch, 224, 256);
70 torch2->AttachToWall(true);
71 return;
72 }
73
InitializePlayer(int plr)74 protected func InitializePlayer(int plr)
75 {
76 // Set player zoom to maximally the landscape height.
77 SetPlayerZoomByViewRange(plr, nil, LandscapeHeight(), PLRZOOM_LimitMax);
78 // Set player zoom to minimally the half the landscape width.
79 SetPlayerZoomByViewRange(plr, LandscapeWidth() / 2, nil, PLRZOOM_LimitMin);
80 // Set player zoom to be standard the landscape width.
81 SetPlayerZoomByViewRange(plr, LandscapeWidth(), nil, PLRZOOM_Direct);
82 SetPlayerViewLock(plr, true);
83 return;
84 }
85
86 // Refill/fill chests.
FxIntFillChestsStart(object target,proplist effect,int temporary,object chest)87 global func FxIntFillChestsStart(object target, proplist effect, int temporary, object chest)
88 {
89 if (temporary)
90 return 1;
91 // Store weapon list and chest.
92 effect.w_list = [Dynamite, Dynamite, Firestone, Firestone, Bow, Blunderbuss, Club, Sword, Javelin, IronBomb, PowderKeg];
93 effect.chest = chest;
94 // Fill the chest with ten items.
95 for (var i = 0; i < 10; i++)
96 effect.chest->CreateChestContents(effect.w_list[Random(GetLength(effect.w_list))]);
97 return 1;
98 }
99
FxIntFillChestsTimer(object target,proplist effect,int time)100 global func FxIntFillChestsTimer(object target, proplist effect, int time)
101 {
102 // Refill the chest with up to ten items.
103 if (effect.chest->ContentsCount() < 10 || !Random(effect.chest->ContentsCount()))
104 effect.chest->CreateChestContents(effect.w_list[Random(GetLength(effect.w_list))]);
105 return 1;
106 }
107
CreateChestContents(id obj_id)108 global func CreateChestContents(id obj_id)
109 {
110 if (!this)
111 return;
112 var obj = CreateObjectAbove(obj_id);
113 if (obj_id == Bow)
114 obj->CreateContents([Arrow, BombArrow][Random(2)]);
115 if (obj_id == Blunderbuss)
116 obj->CreateContents(LeadBullet);
117 obj->Enter(this);
118 return;
119 }
120
121 // GameCall from RelaunchContainer.
OnClonkEnteredRelaunch(object clonk)122 public func OnClonkEnteredRelaunch(object clonk)
123 {
124 clonk->CreateContents(Sword);
125 }
126
127 // GameCall from RelaunchContainer.
OnClonkLeftRelaunch(object clonk)128 public func OnClonkLeftRelaunch(object clonk)
129 {
130 clonk->SetPosition(RandomX(120, 160), -20);
131 clonk->Fling(0,5);
132 return;
133 }
134
RelaunchPosition()135 public func RelaunchPosition()
136 {
137 return [LandscapeWidth() / 2, LandscapeHeight() / 2];
138 }
139
KillsToRelaunch()140 public func KillsToRelaunch() { return 0; }
RelaunchWeaponList()141 public func RelaunchWeaponList() { return [Bow, Shield, Firestone, Dynamite, Javelin, Blunderbuss]; }
142