-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added more frozen things, rainbow elements
- Loading branch information
1 parent
4e98c76
commit ad8979d
Showing
25 changed files
with
561 additions
and
17 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifndef QUARTZ_H | ||
#define QUARTZ_H | ||
|
||
#include "../element.h" | ||
|
||
class Quartz: public Element { | ||
public: | ||
void process(SandSimulation *sim, int row, int col) override { | ||
} | ||
|
||
double get_density() override { | ||
return 2.0; | ||
} | ||
|
||
double get_explode_resistance() override { | ||
return 0.2; | ||
} | ||
|
||
double get_acid_resistance() override { | ||
return 0.85; | ||
} | ||
|
||
int get_state() override { | ||
return 0; | ||
} | ||
|
||
int get_temperature() override { | ||
return 0; | ||
} | ||
|
||
int get_toxicity() override { | ||
return 0; | ||
} | ||
}; | ||
|
||
#endif // QUARTZ_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#ifndef SPRINKLES_H | ||
#define SPRINKLES_H | ||
|
||
#include "../element.h" | ||
|
||
class Sprinkles: public Element { | ||
public: | ||
const double FLAME = 1 / 64.0; | ||
const double POWDER = 1 / 1.04; | ||
|
||
void process(SandSimulation *sim, int row, int col) override { | ||
if (sim->randf() >= POWDER) | ||
return; | ||
bool bot_left = sim->is_swappable(row, col, row + 1, col - 1); | ||
bool bot = sim->is_swappable(row, col, row + 1, col); | ||
bool bot_right = sim->is_swappable(row, col, row + 1, col + 1); | ||
if (bot) { | ||
sim->move_and_swap(row, col, row + 1, col); | ||
} else if (bot_left && bot_right) { | ||
sim->move_and_swap(row, col, row + 1, col + (sim->randf() < 0.5 ? 1 : -1)); | ||
} else if (bot_left) { | ||
sim->move_and_swap(row, col, row + 1, col - 1); | ||
} else if (bot_right) { | ||
sim->move_and_swap(row, col, row + 1, col + 1); | ||
} | ||
} | ||
|
||
double get_density() override { | ||
return 2.0; | ||
} | ||
|
||
double get_explode_resistance() override { | ||
return 0.05; | ||
} | ||
|
||
double get_acid_resistance() override { | ||
return 0.2; | ||
} | ||
|
||
int get_state() override { | ||
return 0; | ||
} | ||
|
||
int get_temperature() override { | ||
return 0; | ||
} | ||
|
||
int get_toxicity() override { | ||
return 0; | ||
} | ||
}; | ||
|
||
#endif // SPRINKLES_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#ifndef FROZEN_ACID_H | ||
#define FROZEN_ACID_H | ||
|
||
#include "../element.h" | ||
|
||
class FrozenAcid: public Element { | ||
public: | ||
const double GROW = 1.0 / 256; | ||
const double FLAME = 1.0 / 128; | ||
|
||
void process(SandSimulation *sim, int row, int col) override { | ||
// Melt | ||
if (sim->randf() < FLAME && sim->is_on_fire(row, col)) { | ||
sim->set_cell(row, col, 21); | ||
return; | ||
} | ||
|
||
if (sim->randf() >= GROW) { | ||
return; | ||
} | ||
|
||
// We need to empty this cell for ice branching checks | ||
sim->set_cell(row, col, 0); | ||
int dir = (int) (sim->randf() * 3) - 1; | ||
if (dir != 0 && sim->cardinal_touch_count(row, col + dir, 154) == 0) { | ||
sim->grow(row, col + dir, 21, 154); | ||
sim->grow(row, col + dir, 59, 154); | ||
} else if (sim->cardinal_touch_count(row + 1, col, 154) == 0) { | ||
sim->grow(row + 1, col, 21, 154); | ||
sim->grow(row + 1, col, 59, 154); | ||
} | ||
sim->set_cell(row, col, 154); | ||
} | ||
|
||
double get_density() override { | ||
return 1.1; | ||
} | ||
|
||
double get_explode_resistance() override { | ||
return 0.35; | ||
} | ||
|
||
double get_acid_resistance() override { | ||
return 1.0; | ||
} | ||
|
||
int get_state() override { | ||
return 0; | ||
} | ||
|
||
int get_temperature() override { | ||
return 0; | ||
} | ||
|
||
int get_toxicity() override { | ||
return 0; | ||
} | ||
}; | ||
|
||
#endif // FROZEN_ACID_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#ifndef FROZEN_AMMONIA_H | ||
#define FROZEN_AMMONIA_H | ||
|
||
#include "../element.h" | ||
|
||
class FrozenAmmonia: public Element { | ||
public: | ||
const double GROW = 1.0 / 256; | ||
const double FLAME = 1.0 / 128; | ||
|
||
void process(SandSimulation *sim, int row, int col) override { | ||
// Melt | ||
if (sim->randf() < FLAME && sim->is_on_fire(row, col)) { | ||
sim->set_cell(row, col, 136); | ||
return; | ||
} | ||
|
||
if (sim->randf() >= GROW) { | ||
return; | ||
} | ||
|
||
// We need to empty this cell for ice branching checks | ||
sim->set_cell(row, col, 0); | ||
int dir = (int) (sim->randf() * 3) - 1; | ||
if (dir != 0 && sim->cardinal_touch_count(row, col + dir, 155) == 0) { | ||
sim->grow(row, col + dir, 136, 155); | ||
} else if (sim->cardinal_touch_count(row + 1, col, 155) == 0) { | ||
sim->grow(row + 1, col, 136, 155); | ||
} | ||
sim->set_cell(row, col, 155); | ||
} | ||
|
||
double get_density() override { | ||
return 1.1; | ||
} | ||
|
||
double get_explode_resistance() override { | ||
return 0.35; | ||
} | ||
|
||
double get_acid_resistance() override { | ||
return 1.0; | ||
} | ||
|
||
int get_state() override { | ||
return 0; | ||
} | ||
|
||
int get_temperature() override { | ||
return 0; | ||
} | ||
|
||
int get_toxicity() override { | ||
return 0; | ||
} | ||
}; | ||
|
||
#endif // FROZEN_AMMONIA_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef ALIEN_H | ||
#define ALIEN_H | ||
|
||
#include "../element.h" | ||
|
||
class Alien: public Element { | ||
public: | ||
const double GROWTH = 0.0049625; | ||
const double DISSOLVE = 1.0 / 64; | ||
|
||
void process(SandSimulation *sim, int row, int col) override { | ||
sim->grow(row + 1, col, 0, 150); | ||
sim->grow(row - 1, col, 0, 150); | ||
sim->grow(row, col + 1, 0, 150); | ||
sim->grow(row, col - 1, 0, 150); | ||
} | ||
|
||
double get_density() override { | ||
return 1.25; | ||
} | ||
|
||
double get_explode_resistance() override { | ||
return 0.55; | ||
} | ||
|
||
double get_acid_resistance() override { | ||
return 0.85; | ||
} | ||
|
||
int get_state() override { | ||
return 0; | ||
} | ||
|
||
int get_temperature() override { | ||
return 0; | ||
} | ||
|
||
int get_toxicity() override { | ||
return 0; | ||
} | ||
}; | ||
|
||
#endif // ALIEN_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#ifndef FREEZE_RAY_H | ||
#define FREEZE_RAY_H | ||
|
||
#include "../element.h" | ||
|
||
class FreezeRay: public Element { | ||
public: | ||
const double DECAY = 1.0 / 1.5; | ||
const double DESTROY = 1.0 / 24; | ||
void process(SandSimulation *sim, int row, int col) override { | ||
if (sim->randf() < DECAY && sim->in_bounds(row - 1, col) && sim->get_cell(row - 1, col) != 153) { | ||
sim->set_cell(row, col, 89); | ||
return; | ||
} | ||
if (sim->randf() < DESTROY) { | ||
sim->grow(row + 1, col, -1, 153); | ||
sim->grow(row + 2, col, -1, 153); | ||
} | ||
} | ||
|
||
double get_density() override { | ||
return 4.0; | ||
} | ||
|
||
double get_explode_resistance() override { | ||
return 1.0; | ||
} | ||
|
||
double get_acid_resistance() override { | ||
return 1.0; | ||
} | ||
|
||
int get_state() override { | ||
return 0; | ||
} | ||
|
||
int get_temperature() override { | ||
return -1; | ||
} | ||
|
||
int get_toxicity() override { | ||
return 0; | ||
} | ||
}; | ||
|
||
#endif // FREEZE_RAY_H |
Binary file not shown.
Oops, something went wrong.