Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

bunches of stuff

  • Loading branch information...
commit 74316fae33fba7e1254a4870d3a1c6204e09b014 1 parent 3f69535
@trystan authored
Showing with 1,068 additions and 409 deletions.
  1. BIN  asciiPanel.jar
  2. +2 −0  src/iryrwarosh/AppletMain.java
  3. +2 −0  src/iryrwarosh/ApplicationMain.java
  4. +1 −1  src/iryrwarosh/ArmosSaga.java
  5. +17 −0 src/iryrwarosh/Common.java
  6. +44 −13 src/iryrwarosh/Creature.java
  7. +2 −4 src/iryrwarosh/CreatureAiHandler.java
  8. +1 −1  src/iryrwarosh/Evaded.java
  9. +289 −81 src/iryrwarosh/Factory.java
  10. +9 −9 src/iryrwarosh/FameHandler.java
  11. +1 −1  src/iryrwarosh/HitSpikes.java
  12. +5 −1 src/iryrwarosh/Item.java
  13. +1 −1  src/iryrwarosh/ItemSpecialsSaga.java
  14. +1 −1  src/iryrwarosh/Killed.java
  15. +4 −3 src/iryrwarosh/LootSaga.java
  16. +2 −2 src/iryrwarosh/MapExplorationHandler.java
  17. +40 −11 src/iryrwarosh/RivalAi.java
  18. +50 −40 src/iryrwarosh/Tile.java
  19. +1 −1  src/iryrwarosh/Trait.java
  20. +28 −16 src/iryrwarosh/World.java
  21. +186 −41 src/iryrwarosh/Worldgen.java
  22. +0 −87 src/iryrwarosh/screens/CastAdvancedSpellScreen.java
  23. +4 −3 src/iryrwarosh/screens/CastSpellScreen.java
  24. +35 −45 src/iryrwarosh/screens/ChooseStartingItemsScreen.java
  25. +137 −0 src/iryrwarosh/screens/HelpScreen.java
  26. +20 −2 src/iryrwarosh/screens/LookAtScreen.java
  27. +15 −5 src/iryrwarosh/screens/MessageLogScreen.java
  28. +31 −25 src/iryrwarosh/screens/PlayScreen.java
  29. +1 −1  src/iryrwarosh/screens/SneakScreen.java
  30. +130 −13 src/iryrwarosh/screens/StartScreen.java
  31. +9 −1 src/iryrwarosh/screens/WorldMapScreen.java
View
BIN  asciiPanel.jar
Binary file not shown
View
2  src/iryrwarosh/AppletMain.java
@@ -15,6 +15,8 @@
public AppletMain(){
super();
terminal = new AsciiPanel();
+ terminal.setDefaultBackgroundColor(Common.guiBackground);
+ terminal.setDefaultForegroundColor(Common.guiForeground);
add(terminal);
screen = new iryrwarosh.screens.StartScreen();
addKeyListener(this);
View
2  src/iryrwarosh/ApplicationMain.java
@@ -18,6 +18,8 @@
public ApplicationMain(){
super();
terminal = new AsciiPanel();
+ terminal.setDefaultBackgroundColor(Common.guiBackground);
+ terminal.setDefaultForegroundColor(Common.guiForeground);
add(terminal);
pack();
screen = new StartScreen();
View
2  src/iryrwarosh/ArmosSaga.java
@@ -16,7 +16,7 @@ public void handle(BumpedIntoObsticle message) {
private void makeArmos(World world, int x, int y) {
Tile statue = Tile.STATUE;
- world.setTile(Tile.WHITE_DIRT, x, y);
+ world.setTile(Tile.WHITE_TILE1.variation(x, y), x, y);
Creature armos = new Creature("armos", statue.glyph(), statue.color(), 5){
public void update(World world){
super.update(world);
View
17 src/iryrwarosh/Common.java
@@ -0,0 +1,17 @@
+package iryrwarosh;
+
+import java.awt.Color;
+
+public class Common {
+ public static Color guiForeground = hsv(120, 5, 66);
+ public static Color guiBackground = hsv(120, 5, 5);
+
+ public static Color playScreenForeground = hsv(20, 33, 66);
+ public static Color playScreenBackground = hsv(20, 30, 15);
+
+
+ public static Color hsv(int h, int s, int v){
+ return Color.getHSBColor(h / 360f, s / 100f, v / 100f);
+ }
+
+}
View
57 src/iryrwarosh/Creature.java
@@ -84,6 +84,9 @@ public String description(){
if (rightHand != null)
text += " " + rightHand.name();
+ if (loot != null)
+ text += " (drops " + loot.name() + ")";
+
return text;
}
@@ -120,11 +123,18 @@ public boolean canEnter(Tile tile){
return false;
}
+ public boolean isHuman(){
+ return glyph == '@';
+ }
+
public void jumpBy(World world, int dx, int dy){
+ if (dx == 0 && dy == 0 || isHidden())
+ return;
+
boolean didJump = false;
for (int i = 0; i < 3; i++){
- if (glyph == '@' && rupees < 1)
+ if (isHuman() && rupees < 1)
break;
Tile tile = world.tile(position.x+dx, position.y+dy);
@@ -151,11 +161,10 @@ public void jumpBy(World world, int dx, int dy){
}
public void moveBy(World world, int x, int y) {
- if (x==0 && y==0)
+ if (x==0 && y==0 || isHidden())
return;
- if (hasDoubleMovedThisTurn
- || hasMovedThisTurn && !hasTrait(Trait.DOUBLE_MOVE))
+ if (hasMovedThisTurn && !hasTrait(Trait.DOUBLE_MOVE))
return;
if (hasTrait(Trait.TERRITORIAL)
@@ -193,14 +202,14 @@ public void moveBy(World world, int x, int y) {
}
public boolean isFriendlyTo(Creature other){
- if (glyph == '@' && other.glyph == '@')
+ if (isHuman() && other.isHuman())
return this == other;
else
return Character.toLowerCase(other.glyph) == Character.toLowerCase(this.glyph);
}
public void attack(World world, Creature other, String specialType){
- if (other.hearts < 1 || hearts < 1)
+ if (other.hearts < 1 || hearts < 1 || isHidden() || other.isHidden())
return;
if (hasDoubleAttackedThisTurn
@@ -225,7 +234,7 @@ public void attack(World world, Creature other, String specialType){
if (hasTrait(Trait.SLOWING_ATTACK) && other.hearts > 0)
reduceEvasion(world, other);
- other.loseHearts(world, this, hasTrait(Trait.STRONG_ATTACK) ? 2 : 1, specialType, "You were slain by a " + name());
+ other.loseHearts(world, this, hasTrait(Trait.STRONG_ATTACK) ? 2 : 1, specialType, getSlainByText());
if (hasTrait(Trait.POISONOUS) && other.hearts > 0)
poison(world, other);
@@ -238,6 +247,20 @@ public void attack(World world, Creature other, String specialType){
}
}
+ private String getSlainByText() {
+ String text = "You were slain by ";
+ char first = name().charAt(0);
+
+ if (Character.isUpperCase(first))
+ text += name();
+ else if ("aeiou".contains(""+first))
+ text += "an " + name();
+ else
+ text += "a " + name();
+
+ return text;
+ }
+
private void reduceEvasion(World world, Creature other) {
other.reducedEvasionCounter += 10;
@@ -314,10 +337,10 @@ public void update(World world){
homeScreenPosition = new Point(position.x / 19, position.y / 9);
if (leftHand != null)
- leftHand.update(this);
+ leftHand.update(world, this);
if (rightHand != null)
- rightHand.update(this);
+ rightHand.update(world, this);
if (poisonCounter > 0 && poisonCounter-- % 5 == 0)
loseHearts(world, lastPoisonedBy, 1, null, "You died of poison from a " + lastPoisonedBy.name());
@@ -333,13 +356,14 @@ public void update(World world){
if (hasTrait(Trait.HIDER) && hiddenCounter-- < 1){
hiddenCounter = 5 + (int)(Math.random() * 5);
+
if (positionBeforeHiding == null)
hide(world);
else
unhide(world);
}
- if (!canEnter(world.tile(position.x, position.y)))
+ if (!isHidden() && !canEnter(world.tile(position.x, position.y)))
loseHearts(world, this, 1, null, "You died from standing in " + world.tile(position.x, position.y).description());
if (hasTrait(Trait.ROCK_SPITTER)
@@ -379,7 +403,7 @@ private void unhide(World world) {
position.y = y;
positionBeforeHiding = null;
}
-
+
publishMessage(new Unhid(world, this));
if (hasTrait(Trait.ROCK_SPITTER))
@@ -387,6 +411,9 @@ private void unhide(World world) {
}
private void hide(World world) {
+ if (!world.tile(position.x, position.y).canHideIn())
+ return;
+
positionBeforeHiding = position.copy();
publishMessage(new Hid(world, this));
position.x = -100;
@@ -398,12 +425,12 @@ public boolean isHidden(){
}
public void wander(World world){
- if (prey != null && (prey.hearts < 1 || prey.isHidden()))
+ if (prey != null && (prey.hearts < 1 || prey.isHidden() || huntCounter-- < 1))
prey = null;
else if (prey != null && prey.hearts > 0)
moveTo(world, prey);
- if (preditor != null && (preditor.hearts < 1 || preditor.isHidden()))
+ if (preditor != null && (preditor.hearts < 1 || preditor.isHidden() || fleeCounter-- < 1))
preditor = null;
else if (preditor != null && preditor.hearts > 0)
moveFrom(world, preditor);
@@ -502,13 +529,17 @@ public void loseHearts(World world, Creature attacker, int amount, String specia
}
private Creature prey;
+ private int huntCounter;
public void hunt(Creature prey) {
this.prey = prey;
+ huntCounter = 6;
}
private Creature preditor;
+ private int fleeCounter;
public void fleeFrom(Creature preditor) {
this.preditor = preditor;
+ fleeCounter = 4;
}
public void gainRupees(int amount) {
View
6 src/iryrwarosh/CreatureAiHandler.java
@@ -13,10 +13,10 @@ public void handle(Message message) {
public void handle(CallForHelp message) {
for (Creature c : message.world.creatures()){
- if (!message.attacked.isFriendlyTo(c) || c == message.attacked)
+ if (!c.isFriendlyTo(message.attacked) || c == message.attacked)
continue;
- if (c.canHear(message.attacked))
+ if (!c.canHear(message.attacked))
continue;
c.hunt(message.attacker);
@@ -26,7 +26,5 @@ public void handle(CallForHelp message) {
public void handle(Attacked message) {
if (message.attacked.hasTrait(Trait.HUNTER))
message.attacked.hunt(message.attacker);
- else if (message.attacked.hasTrait(Trait.FEARFUL))
- message.attacked.fleeFrom(message.attacker);
}
}
View
2  src/iryrwarosh/Evaded.java
@@ -5,7 +5,7 @@
public Creature evader;
public Evaded(World world, Creature attacker, Creature evader){
- super(world, addArticle("The", evader.name()) + " evaded the " + attacker.name());
+ super(world, addArticle("The", evader.name()) + " evaded " + addArticle("the", attacker.name()));
this.attacker = attacker;
this.evader = evader;
}
View
370 src/iryrwarosh/Factory.java
@@ -1,6 +1,5 @@
package iryrwarosh;
-import iryrwarosh.screens.CastAdvancedSpellScreen;
import iryrwarosh.screens.CastSpellScreen;
import iryrwarosh.screens.DiveScreen;
import iryrwarosh.screens.JumpScreen;
@@ -20,35 +19,39 @@
private HashMap<Tile,List<Trait>> monsterTraits;
private List<Item> minibossLoot;
private List<Creature> rivals;
+ private int defaultHearts;
public Factory(){
+ defaultHearts = 15;
setMonsterTraits();
minibossLoot = new ArrayList<Item>();
minibossLoot.add(this.ringOfRegeneration());
minibossLoot.add(this.magicCarpet());
- minibossLoot.add(this.advancedSpellBook());
+ minibossLoot.add(this.mutationRing());
minibossLoot.add(this.ringOfEvasion());
minibossLoot.add(this.darkCloak());
minibossLoot.add(this.rupeeMachine());
minibossLoot.add(this.rupeeAmulet());
- minibossLoot.add(this.evasionPotion());
- minibossLoot.add(this.lostArtifact());
+ minibossLoot.add(this.spikedArmor());
+ minibossLoot.add(this.bagOfImps());
+ minibossLoot.add(this.magicWand());
+ minibossLoot.add(this.bombs());
Collections.shuffle(minibossLoot);
rivals = new ArrayList<Creature>();
- rivals.add(rival("Dork", 0, knife(), bow(), new RivalAi(0.01)));
- rivals.add(rival("Lame", 30, staff(), null, new RivalAi(0.00)));
- rivals.add(rival("Bela", 60, spear(), null, new RivalAi(0.01)));
- rivals.add(rival("Lulz", 90, club(), null, new RivalAi(0.05)));
- rivals.add(rival("Link", 120, sword(), shield(), new RivalAi(0.005)));
- rivals.add(rival("Dojj", 150, knife(), ringOfEvasion(), new RivalAi(0.005)));
- rivals.add(rival("Majk", 180, staff(), advancedSpellBook(), new RivalAi(0.01)));
- rivals.add(rival("Ring", 210, ringOfEvasion(), ringOfRegeneration(), new RivalAi(0.01)));
- rivals.add(rival("Swim", 240, club(), snorkel(), new RivalAi(0.01)));
- rivals.add(rival("Tify", 270, spear(), spectacles(), new RivalAi(0.01)));
- rivals.add(rival("Hans", 300, spear(), club(), new RivalAi(0.01)));
- rivals.add(rival("Mr X", 330, spear(), knife(), new RivalAi(0.005)));
+ rivals.add(rival("Lame", 0, knife(), bow(), new RivalAi(0.01, 1.0)));
+ rivals.add(rival("Dork", 30, staff(), null, new RivalAi(0.00, 1.0)));
+ rivals.add(rival("Max" + (char)4, 60, knife(), ringOfEvasion(), new RivalAi(0.005, 0.5)));
+ rivals.add(rival("Lulz", 90, club(), null, new RivalAi(0.05, 1.0)));
+ rivals.add(rival("Link", 120, sword(), shield(), new RivalAi(0.005, 0.1)));
+ rivals.add(rival("Bela", 150, spear(), null, new RivalAi(0.01, 0.5)));
+ rivals.add(rival("L33t", 180, knife(), club(), new RivalAi(0.01, 0.5)));
+ rivals.add(rival("Mr X", 210, darkCloak(), knife(), new RivalAi(0.005, 0.0)));
+ rivals.add(rival("Toad", 240, club(), snorkel(), new RivalAi(0.01, 0.5)));
+ rivals.add(rival("Tify", 270, spear(), spectacles(), new RivalAi(0.01, 0.5)));
+ rivals.add(rival("Muto", 130, staff(), mutationRing(), new RivalAi(0.01, 0.5)));
+ rivals.add(rival("Al ", 330, magicCarpet(), null, new RivalAi(0.01, 0.5)));
Collections.shuffle(rivals);
}
@@ -60,6 +63,12 @@ private void setMonsterTraits(){
List<Trait> traits = new ArrayList<Trait>();
+ if (biome == Tile.WATER1){
+ traits.add(Trait.SWIMMER);
+ } else {
+ traits.add(Trait.WALKER);
+ }
+
switch ((int)(Math.random() * 4)){
case 0: traits.add(Trait.POISONOUS); break;
case 1: traits.add(Trait.AGGRESSIVE); break;
@@ -67,12 +76,6 @@ private void setMonsterTraits(){
case 3: traits.add(Trait.DOUBLE_MOVE); break;
}
- if (biome == Tile.WATER1){
- traits.add(Trait.SWIMMER);
- } else {
- traits.add(Trait.WALKER);
- }
-
while (traits.size() < 4){
Trait trait = Trait.getRandom();
if (!traits.contains(trait))
@@ -86,17 +89,17 @@ private void setMonsterTraits(){
public Item knife(){
Item item = new Item("knife", ')', Tile.WHITE_ROCK.background(), "Melee weapon that attacks when you evade. Can be poisoned."){
int poisonCounter = 0;
- World world;
- public void update(Creature owner){
- super.update(owner);
+ public void update(World world, Creature owner){
+ super.update(world, owner);
if (poisonCounter > 0)
poisonCounter--;
if (poisonCounter == 0 && hasTrait(Trait.POISONOUS)) {
removeTrait(Trait.POISONOUS);
- MessageBus.publish(new Note(world, owner, "Your knife is no longer poisonous."));
+ if (owner != null)
+ MessageBus.publish(new Note(world, owner, "Your knife is no longer poisonous."));
}
}
@@ -106,8 +109,6 @@ public Screen use(Screen screen, World world, Creature owner){
return screen;
}
- this.world = world;
-
if (!hasTrait(Trait.POISONOUS))
addTrait(Trait.POISONOUS);
@@ -133,11 +134,12 @@ public Screen use(Screen screen, World world, Creature owner){
for (Point p : owner.position.neighbors()){
Creature other = world.creature(p.x, p.y);
- if (other == null || owner.isFriendlyTo(other))
+ if (other == null)
continue;
owner.attack(world, other, "with a wide swing");
}
+ owner.loseRupees(world, 1);
return screen;
}
};
@@ -182,7 +184,7 @@ public boolean canEnter(Tile tile){
}
public Item spear(){
- Item item = new Item("spear", ')', Tile.BROWN_ROCK.background(), "Melee weapon that auto-attacks near you. Can be thrown."){
+ Item item = new Item("spear", ')', Tile.BROWN_ROCK.background(), "Long melee weapon that auto-attacks near you. Can be thrown."){
public Screen use(Screen screen, World world, Creature owner){
if (owner.rupees() + owner.hearts() <= 2) {
MessageBus.publish(new Note(world, owner, "You need more than 2 rupees or hearts to throw a spear."));
@@ -214,8 +216,9 @@ else if ((dir.x == -1 || dir.x == 1) && dir.y == 0)
}
public Item staff(){
- Item item = new Item("staff", ')', Tile.BROWN_ROCK.background(), "Melee weapon that can parry attacks and will counter attack.");
+ Item item = new Item("long staff", ')', Tile.BROWN_ROCK.background(), "Long melee weapon that can also parry and counter attack.");
item.addTrait(Trait.COUNTER_ATTACK);
+ item.addTrait(Trait.REACH_ATTACK);
item.addTrait(Trait.DEFLECT_MELEE);
item.addTrait(Trait.STRONG_ATTACK);
return item;
@@ -238,7 +241,7 @@ public Creature miniboss(World world, int sx, int sy){
char glyph = glyphs[(int)(Math.random() * glyphs.length)];
int hue = (int)(Math.random() * 360);
- int hp = 5 + (int)(Math.random() * 6);
+ int hp = defaultHearts / 2 + (int)(Math.random() * defaultHearts / 2);
List<Trait> traits = new ArrayList<Trait>();
traits.add(Trait.WALKER);
@@ -253,7 +256,7 @@ public Creature miniboss(World world, int sx, int sy){
traits.add(trait);
}
- Creature boss = new Creature(makeMinibossName(traits), glyph, Tile.hsv(hue, 33, 66), hp){
+ Creature boss = new Creature(makeMinibossName(traits), glyph, Common.hsv(hue, 33, 66), hp){
public void update(World world){
super.update(world);
wander(world);
@@ -274,20 +277,24 @@ public void update(World world){
if (minibossLoot.size() > 0)
boss.setLoot(minibossLoot.remove(0));
- else if (Math.random() < 0.5)
- boss.setLoot(heartIncrease());
- else
- boss.setLoot(lostArtifact());
+ else {
+ switch ((int)(Math.random() * 4)){
+ case 0: boss.setLoot(heartContainer()); break;
+ case 1: boss.setLoot(bigMoney()); break;
+ case 2: boss.setLoot(evasionPotion()); break;
+ case 3: boss.setLoot(this.lostArtifact()); break;
+ }
+ }
return boss;
}
private String makeMinibossName(List<Trait> traits) {
- String[] first = { "giant", "ugly", "malformed", "putrid", "rotten", "infested", "putrid", "crazed", "wild" };
+ String[] first = { "giant", "ugly", "malformed", "putrid", "rotten", "infested", "ancient", "crazed", "wild", "hated" };
String[] second = { "spider", "squid", "jellyfish", "bird", "urchin", "demon", "scorpion", "insect", "blob",
- "wolf", "lion", "serpent", "monster" };
+ "evil", "best", "serpent", "monster" };
String name = first[(int)(Math.random() * first.length)]
+ " " + second[(int)(Math.random() * second.length)];
@@ -297,7 +304,7 @@ private String makeMinibossName(List<Trait> traits) {
public Creature goblin(final World world){
int hue = 30 + (int)(Math.random() * 90);
- Creature goblin = new Creature("goblin", 'g', Tile.hsv(hue, 50, 50), 3){
+ Creature goblin = new Creature("goblin", 'g', Common.hsv(hue, 50, 50), 3){
public void update(World world){
super.update(world);
wander(world);
@@ -385,6 +392,9 @@ public Creature monster(final World world, Tile biome){
boolean isBigMonster = Math.random() * 1000 < (monstersCreated - 300);
+ if (isBigMonster)
+ name = "giant " + name;
+
Creature monster = new Creature(name, isBigMonster ? 'M' : 'm', color, isBigMonster ? 7 : 3){
public void update(World world){
super.update(world);
@@ -413,7 +423,7 @@ public void update(World world){
}
public Creature player(World world) {
- Creature player = new Creature("player", '@', AsciiPanel.brightWhite, 10);
+ Creature player = new Creature("player", '@', AsciiPanel.brightWhite, defaultHearts);
player.addTrait(Trait.WALKER);
player.addTrait(Trait.LOOTLESS);
world.add(player);
@@ -438,7 +448,7 @@ public Creature rival(World world){
}
public Creature rival(String name, int hue, Item item1, Item item2, final RivalAi ai){
- Creature rival = new Creature(name, '@', Tile.hsv(hue, 80, 80), 10){
+ Creature rival = new Creature(name, '@', Common.hsv(hue, 80, 80), defaultHearts){
public void update(World world){
super.update(world);
ai.update(world, this);
@@ -455,7 +465,7 @@ public void update(World world){
rival.swapRightHand(null, item2);
if (Math.random() < 0.5)
- rival.setLoot(heartIncrease());
+ rival.setLoot(heartContainer());
else
rival.setLoot(bigMoney());
@@ -463,19 +473,57 @@ public void update(World world){
}
public Item heavyArmor() {
- Item item = new Item("heavy armor", '[', AsciiPanel.yellow, -2, "Reduces damage done from heavy hitters.");
+ Item item = new Item("heavy armor", '[', AsciiPanel.yellow, -2, "Reduces damage from heavy hitters.");
+ item.addTrait(Trait.EXTRA_DEFENSE);
+ return item;
+ }
+
+ public Item spikedArmor() {
+ Item item = new Item("spiked armor", '[', AsciiPanel.yellow, -2, "Reduces damage from heavy hitters. Also covered in spikes.");
item.addTrait(Trait.EXTRA_DEFENSE);
+ item.addTrait(Trait.SPIKED);
return item;
}
public Item shield() {
- Item item = new Item("shield", '[', AsciiPanel.yellow, -1, "Deflects projectiles.");
+ Item item = new Item("large shield", '[', AsciiPanel.yellow, -1, "Deflects projectiles. Can be used to scare others nearby."){
+ public Screen use(Screen screen, World world, Creature player) {
+ if (player.rupees() + player.hearts() <= 1){
+ MessageBus.publish(new Note(world, player, "You need more than 1 rupee or heart to intimidate others."));
+ return screen;
+ }
+
+ int number = 0;
+
+ for (Creature c : world.creaturesNear(player)){
+ if (c.isFriendlyTo(player) || c.isMiniboss())
+ continue;
+
+ number++;
+ c.fleeFrom(player);
+ player.loseRupees(world, 1);
+ }
+
+ switch(number){
+ case 0:
+ MessageBus.publish(new Note(world, player, "You swing wildly but didn't scare anyone away."));
+ break;
+ case 1:
+ MessageBus.publish(new Note(world, player, "You swing wildly and scare 1 nearby creature."));
+ break;
+ default:
+ MessageBus.publish(new Note(world, player, "You swing wildly and scare " + number + " nearby creatures."));
+ break;
+ }
+ return screen;
+ }
+ };
item.addTrait(Trait.DEFLECT_RANGED);
return item;
}
public Item spectacles() {
- Item item = new Item("spectacles", '/', Tile.hsv(220, 15, 50), "Allows you to see camouflaged creatures. Use to see far away."){
+ Item item = new Item("spectacles", '/', Common.hsv(220, 15, 50), "Allows you to see camouflaged creatures. Use to see far away."){
public Screen use(Screen screen, World world, Creature player) {
if (player.rupees() + player.hearts() <= 1){
MessageBus.publish(new Note(world, player, "You need more than 1 rupee or heart to look far away."));
@@ -491,7 +539,7 @@ public Screen use(Screen screen, World world, Creature player) {
}
public Item bow() {
- Item item = new Item("bow", ')', Tile.hsv(45, 50, 50), "Shoots deady arrows."){
+ Item item = new Item("bow", ')', Common.hsv(45, 50, 50), "Shoots deady arrows."){
public Screen use(Screen screen, World world, Creature owner){
if (owner.rupees() + owner.hearts() <= 1){
MessageBus.publish(new Note(world, owner, "You need more than 1 rupee or heart to shoot arrows."));
@@ -520,6 +568,67 @@ else if ((dir.x == -1 || dir.x == 1) && dir.y == 0)
return item;
}
+ public Item bombs() {
+ Item item = new Item("bombs", ')', Common.hsv(220, 75, 75), "Pay 3" + (char)4 + " to place a bomb."){
+ public Screen use(Screen screen, World world, Creature owner){
+ if (owner.rupees() + owner.hearts() <= 3){
+ MessageBus.publish(new Note(world, owner, "You need more than 3 rupees and hearts to place a bomb."));
+ return screen;
+ }
+
+ Point where = owner.position;
+
+ world.add(bomb(owner, where.x, where.y), where.x, where.y);
+ owner.loseRupees(world, 1);
+ return screen;
+ }
+ };
+ item.setCanBePickedUp(false);
+ return item;
+ }
+
+ private Item bomb(final Creature owner, final int x, final int y) {
+ Item item = new Item("bomb", 248, Common.hsv(220, 75, 75), "Stand back!"){
+ int countdown = 3;
+
+ public void update(World world, Creature owner){
+ if (countdown-- == 0)
+ explode(world);
+ }
+
+ private void explode(World world){
+ Creature here = world.creature(x, y);
+ if (here != null)
+ here.loseHearts(world, owner, 5, "with a bomb", "You have been blown up by one of " + owner.name() + "'s bomb");
+
+ for (Point p : new Point(x, y).neighbors()){
+ here = world.creature(p.x, p.y);
+ if (here != null)
+ here.loseHearts(world, owner, 2, "with a bomb", "You have been blown up by one of " + owner.name() + "'s bomb");
+ }
+ world.removeItem(x, y);
+ world.add(smoke(x, y), x, y);
+ for (Point p : new Point(x, y).neighbors()){
+ world.removeItem(p.x, p.y);
+ world.add(smoke(p.x, p.y), p.x, p.y);
+ }
+ }
+ };
+ item.setCanBePickedUp(false);
+ return item;
+ }
+
+ private Item smoke(final int x, final int y) {
+ Item item = new Item("smoke", '*', Common.hsv(220, 0, 75), "Smoke from a bomb"){
+
+ public void update(World world, Creature owner){
+ world.removeItem(x, y);
+ }
+ };
+ item.setCanBePickedUp(false);
+ return item;
+ }
+
public Item snorkel() {
Item item = new Item("snorkel", '/', Tile.WATER2.color(), "Allows you to swim. Can be used to swim underwater."){
public Screen use(Screen screen, World world, Creature owner){
@@ -539,7 +648,7 @@ public Screen use(Screen screen, World world, Creature owner){
}
public Item firstAidKit() {
- Item item = new Item("first aid kit", '+', Tile.hsv(20, 50, 50), "Use to cure poison or recover health."){
+ Item item = new Item("first aid kit", '+', Common.hsv(20, 50, 50), "Use to cure poison or recover health."){
public Screen use(Screen screen, World world, Creature owner){
if (owner.rupees() < 5){
MessageBus.publish(new Note(world, owner, "You need at least 5 rupees to cure poison or heal yourself."));
@@ -567,11 +676,11 @@ public Item ringOfRegeneration() {
}
public Item rupeeMachine() {
- Item item = new Item("rupee machine", '/', Tile.hsv(60, 75, 25), "Automatically creates rupees."){
- public void update(Creature owner){
- super.update(owner);
+ Item item = new Item("rupee machine", '/', Common.hsv(210, 25, 90), "Automatically creates rupees."){
+ public void update(World world, Creature owner){
+ super.update(world, owner);
- if (Math.random() < 0.05)
+ if (owner != null && Math.random() < 0.1)
owner.gainRupees(1);
}
};
@@ -579,10 +688,10 @@ public void update(Creature owner){
}
public Item rupeeAmulet() {
- Item item = new Item("rupee amulet", '=', Tile.hsv(60, 75, 25), "Can be used to convert your hearts into rupees."){
+ Item item = new Item("rupee amulet", '=', Common.hsv(210, 25, 90), "Can be used to convert your hearts into rupees."){
public Screen use(Screen screen, World world, Creature owner){
owner.loseHearts(world, owner, 1, null, "You turned the last of your hearts into rupees");
- owner.gainRupees(10);
+ owner.gainRupees(20);
return screen;
}
};
@@ -590,7 +699,7 @@ public Screen use(Screen screen, World world, Creature owner){
}
public Item spellBook() {
- Item item = new Item("spellbook", '+', Tile.hsv(200, 50, 50), "Used to cast one of 3 basic spells."){
+ Item item = new Item("spellbook", '+', Common.hsv(200, 50, 50), "Used to cast one of 3 basic spells."){
public Screen use(Screen screen, World world, Creature owner){
return new CastSpellScreen(screen, world, owner);
}
@@ -603,24 +712,15 @@ public Item magicCarpet() {
item.addTrait(Trait.FLIER);
return item;
}
-
- public Item advancedSpellBook() {
- Item item = new Item("advanced spellbook", '+', AsciiPanel.white, "Use to cast one of 3 advanced spells."){
- public Screen use(Screen screen, World world, Creature owner){
- return new CastAdvancedSpellScreen(screen, world, owner);
- }
- };
- return item;
- }
- public Item heartIncrease(){
+ public Item heartContainer(){
Item item = new Item("heart increase", 3, AsciiPanel.brightRed, "Increases your max hearts."){
public void onCollide(World world, Creature collider){
- if (collider.glyph() != '@')
- return; // only the player should be able to get these
+ if (!collider.isHuman())
+ return;
collider.increaseMaxHearts(1);
- collider.recoverHearts(100);
+ collider.recoverHearts(10);
world.removeItem(collider.position.x, collider.position.y);
}
};
@@ -629,10 +729,10 @@ public void onCollide(World world, Creature collider){
}
public Item bigMoney(){
- Item item = new Item("rupees", 4, Tile.hsv(210, 25, 90), "Rupees are used for special actions."){
+ Item item = new Item("rupees", 4, Common.hsv(210, 25, 90), "Rupees are used for special actions."){
public void onCollide(World world, Creature collider){
- if (collider.glyph() != '@')
- return; // only the player should be able to get these
+ if (!collider.isHuman())
+ return;
world.removeItem(collider.position.x, collider.position.y);
collider.gainRupees(50);
@@ -643,10 +743,10 @@ public void onCollide(World world, Creature collider){
}
public Item evasionPotion(){
- Item item = new Item("evasion potion", '!', Tile.hsv(90, 33, 66), "Permanently boost your evasion."){
+ Item item = new Item("evasion potion", '!', Common.hsv(90, 33, 66), "Permanently boost your evasion."){
public void onCollide(World world, Creature collider){
- if (collider.glyph() != '@')
- return; // only the player should be able to get these
+ if (!collider.isHuman())
+ return;
world.removeItem(collider.position.x, collider.position.y);
collider.modifyEvasion(1);
@@ -657,17 +757,17 @@ public void onCollide(World world, Creature collider){
}
public Item lostArtifact(){
- String[] first = { "ancient", "historic", "old", "lost", "antique", "famous", "missing" };
+ String[] first = { "ancient", "historic", "old", "lost", "antique", "famous", "missing", "forgotten", "stolen" };
String[] second = { "heirloom", "artifact", "treasure", "item" };
String name = first[(int)(Math.random() * first.length)]
+ " " + second[(int)(Math.random() * second.length)];
int hue = (int)(Math.random() * 360);
- Item item = new Item(name, '?', Tile.hsv(hue, 33, 66), "A " + name + " from the past."){
+ Item item = new Item(name, '?', Common.hsv(hue, 33, 66), "A " + name + " from the past."){
public void onCollide(World world, Creature collider){
- if (collider.glyph() != '@')
- return; // only the player should be able to get these
+ if (!collider.isHuman())
+ return;
world.removeItem(collider.position.x, collider.position.y);
MessageBus.publish(new DiscoveredLostArtifact(world, collider, this));
@@ -678,7 +778,7 @@ public void onCollide(World world, Creature collider){
}
public Item jumpingBoots() {
- Item item = new Item("jumping boots", '[', Tile.hsv(180, 50, 50), "Makes you more evasive and can be used to jump."){
+ Item item = new Item("jumping boots", '[', Common.hsv(180, 50, 50), "Makes you more evasive and can be used to jump."){
public Screen use(Screen screen, World world, Creature owner){
return new JumpScreen(screen, world, owner);
}
@@ -687,12 +787,12 @@ public Screen use(Screen screen, World world, Creature owner){
}
public Item ringOfEvasion() {
- Item item = new Item("ring of evasion", '=', Tile.hsv(90, 33, 66), +5, "Makes you much more evasive.");
+ Item item = new Item("ring of evasion", '=', Common.hsv(90, 33, 66), +5, "Makes you much more evasive.");
return item;
}
public Item darkCloak() {
- Item item = new Item("dark cloak", '[', Tile.hsv(180, 5, 25), +2, "Makes you harder to hit and see. Can be used to sneak."){
+ Item item = new Item("dark cloak", '[', Common.hsv(180, 5, 25), +2, "Makes you harder to hit and see. Can be used to sneak."){
public Screen use(Screen screen, World world, Creature owner){
if (owner.rupees() < 5){
MessageBus.publish(new Note(world, owner, "You need at least 5 rupees to sneak."));
@@ -705,4 +805,112 @@ public Screen use(Screen screen, World world, Creature owner){
item.addTrait(Trait.CAMOUFLAGED);
return item;
}
+
+ public Item bagOfImps() {
+ Item item = new Item("bag of imps", '+', Common.hsv(350, 90, 75), "Costs 5" + (char)4 + " to pull an imp out."){
+ public Screen use(Screen previous, World world, Creature owner){
+ if (owner.rupees() + owner.hearts() <= 5){
+ MessageBus.publish(new Note(world, owner, "You need more than 5 rupees and hearts to summon an imp."));
+ return previous;
+ }
+
+ summonImp(world, owner);
+ owner.loseRupees(world, 5);
+ return previous;
+ }
+ };
+ return item;
+ }
+
+ private void summonImp(World world, final Creature master) {
+ Creature imp = new Creature("imp", (char)139, Common.hsv(350, 90, 75), 5){
+ public void update(World world){
+ super.update(world);
+ if (position.distanceTo(master.position) > 3){
+ int dx = 0;
+ int dy = 0;
+ if (master.position.x < position.x)
+ dx = -1;
+ else if (master.position.x > position.x)
+ dx = 1;
+
+ if (master.position.y < position.y)
+ dy = -1;
+ else if (master.position.y > position.y)
+ dy = 1;
+
+ moveBy(world, dx, dy);
+ } else {
+ wander(world);
+ }
+ }
+
+ public boolean isFriendlyTo(Creature other){
+ return other == master || other.name().equals(name());
+ }
+ };
+ imp.addTrait(Trait.AGGRESSIVE);
+ imp.addTrait(Trait.HUNTER);
+ imp.addTrait(Trait.FLIER);
+ imp.addTrait(Trait.REGENERATES);
+ world.add(imp);
+ Point dir = master.lastMovedDirection();
+ imp.position = master.position.plus(dir.x, dir.y).plus(dir.x, dir.y);
+ }
+
+ public Item magicWand() {
+ Item item = new Item("Magic Missile wand", '/', Common.hsv(0, 0, 75), "Use to shoot 8 weak magic missiles."){
+ public Screen use(Screen previous, World world, Creature owner){
+ magicMissiles(world, owner);
+ owner.loseRupees(world, 8);
+ return previous;
+ }
+ };
+ return item;
+ }
+
+ private void magicMissiles(World world, Creature caster) {
+ world.add(new Projectile("magic missile", caster, 7, Common.hsv(210, 33, 66), 2, caster.position.plus(1, 0), new Point( 1, 0)));
+ world.add(new Projectile("magic missile", caster, 7, Common.hsv(210, 33, 66), 2, caster.position.plus(-1, 0), new Point(-1, 0)));
+ world.add(new Projectile("magic missile", caster, 7, Common.hsv(210, 33, 66), 2, caster.position.plus(0, 1), new Point( 0, 1)));
+ world.add(new Projectile("magic missile", caster, 7, Common.hsv(210, 33, 66), 2, caster.position.plus(0,-1), new Point( 0,-1)));
+ world.add(new Projectile("magic missile", caster, 7, Common.hsv(210, 33, 66), 2, caster.position.plus(-1,-1), new Point(-1,-1)));
+ world.add(new Projectile("magic missile", caster, 7, Common.hsv(210, 33, 66), 2, caster.position.plus(-1, 1), new Point(-1, 1)));
+ world.add(new Projectile("magic missile", caster, 7, Common.hsv(210, 33, 66), 2, caster.position.plus(1,-1), new Point( 1,-1)));
+ world.add(new Projectile("magic missile", caster, 7, Common.hsv(210, 33, 66), 2, caster.position.plus(1, 1), new Point( 1, 1)));
+ }
+
+ public Item mutationRing() {
+ Item item = new Item("mutation ring", '=', Common.hsv(60, 33, 90), "A slight chance of random mutations when wearing this."){
+ public void update(World world, Creature owner){
+ super.update(null, owner);
+
+ if (owner != null && Math.random() < 0.005)
+ mutateSelf(world, owner);
+ }
+ };
+ return item;
+ }
+
+ private void mutateSelf(World world, Creature self) {
+ Trait[] traits = {
+ Trait.CAMOUFLAGED, Trait.COUNTER_ATTACK, Trait.DEFLECT_MELEE, Trait.DEFLECT_RANGED, Trait.DETECT_CAMOUFLAGED,
+ Trait.EVADE_ATTACK, Trait.EXTRA_DEFENSE, Trait.EXTRA_EVADE, Trait.EXTRA_HP, Trait.FLIER, Trait.KNOCKBACK,
+ Trait.POISONOUS, Trait.REACH_ATTACK, Trait.REGENERATES, Trait.SLOWING_ATTACK, Trait.SPIKED, Trait.STRONG_ATTACK,
+ Trait.SWIMMER
+ };
+
+ int tries = 0;
+ while (tries++ < 100){
+ Trait trait = traits[(int)(Math.random() * traits.length)];
+ if (self.hasTrait(trait))
+ continue;
+
+ self.addTrait(trait);
+ MessageBus.publish(new Note(null, self, "You have gained the trait \"" + trait.description() + "\""));
+ self.loseRupees(world, 10);
+ break;
+ }
+ }
}
+
View
18 src/iryrwarosh/FameHandler.java
@@ -49,36 +49,36 @@ public void handle(Message message) {
}
private void handle(Killed message){
- if (message.attacker.glyph() != '@')
+ if (!message.attacker.isHuman())
return;
- if (message.attacked.glyph() == '@')
+ if (message.attacked.isHuman())
gainFame(message.attacker, 15, message.attacker.name() + " has killed " + message.attacked.name());
else if (message.attacked.isMiniboss())
gainFame(message.attacker, 5, message.attacker.name() + " has killed " + message.attacked.name());
else if (message.attacked.glyph() == 'M')
- gainFame(message.attacker, 1, message.attacker.name() + " has killed a giant monster");
+ gainFame(message.attacker, 1, message.attacker.name() + " has killed a " + message.attacked.name());
}
private void handle(ExploredNewBiome message){
- if (message.creature.glyph() != '@')
+ if (!message.creature.isHuman())
return;
- gainFame(message.creature, 8, null);
+ gainFame(message.creature, 9, null);
}
private void handle(ExploredNewLocation message){
- if (message.creature.glyph() != '@')
+ if (!message.creature.isHuman())
return;
- gainFame(message.creature, 2, null);
+ gainFame(message.creature, 1, null);
}
private void handle(DiscoveredLostArtifact message){
- if (message.creature.glyph() != '@')
+ if (!message.creature.isHuman())
return;
- gainFame(message.creature, 15, message.creature.name() + " has discovered treasure: " + message.item.name());
+ gainFame(message.creature, 10, message.creature.name() + " has found something famous: " + message.item.name());
}
private void gainFame(Creature creature, int amount, String string){
View
2  src/iryrwarosh/HitSpikes.java
@@ -5,7 +5,7 @@
public Creature attacked;
public HitSpikes(World world, Creature attacker, Creature attacked){
- super(world, "The " + attacker.name() + " hit the spikes of the " + attacked.name());
+ super(world, addArticle("The", attacker.name()) + " bumped into " + addArticle("the", attacked.name()) + "'s spikes");
this.attacker = attacker;
this.attacked = attacked;
}
View
6 src/iryrwarosh/Item.java
@@ -10,6 +10,10 @@
private int collectableValue;
public int collectableValue() { return collectableValue; }
public void collectableValue(int value) { collectableValue = value; }
+
+ private Boolean canBePickedUp = true;
+ public Boolean canBePickedUp(){ return canBePickedUp; }
+ public void setCanBePickedUp(Boolean value) { canBePickedUp = value; }
private String name;
public String name() { return name; }
@@ -48,7 +52,7 @@ public boolean hasTrait(Trait trait) {
this.evasionModifier = evasionModifier;
}
- public void update(Creature owner){
+ public void update(World world, Creature owner){
}
View
2  src/iryrwarosh/ItemSpecialsSaga.java
@@ -23,7 +23,7 @@ private void checkDistantAttacks(Moved m) {
if (other != null
&& !m.creature.isFriendlyTo(other)
&& other.hasTrait(Trait.REACH_ATTACK) && Math.random() < 0.75){
- other.attack(m.world, m.creature, "with it's long reach");
+ other.attack(m.world, m.creature, other.isPlayer() ? "with your long reach" : "with it's long reach");
}
}
}
View
2  src/iryrwarosh/Killed.java
@@ -5,7 +5,7 @@
public Creature attacked;
public Killed(World world, Creature attacker, Creature attacked){
- super(world, "The " + attacker.name() + " killed the " + attacked.name());
+ super(world, addArticle("The", attacker.name()) + " killed " + addArticle("the", attacked.name()));
this.attacker = attacker;
this.attacked = attacked;
}
View
7 src/iryrwarosh/LootSaga.java
@@ -29,7 +29,8 @@ public void handle(Jumped message){
}
public void handle(Killed message){
- if (message.attacked.hasTrait(Trait.LOOTLESS))
+ if (message.attacked.hasTrait(Trait.LOOTLESS)
+ || message.attacked.isHidden())
return;
if (message.attacked.loot() != null)
@@ -59,7 +60,7 @@ public void onCollide(World world, Creature collider){
}
public Item rupees_1(){
- Item item = new Item("rupees", 4, Tile.hsv(60, 50, 75), "Rupees used for special actions."){
+ Item item = new Item("rupees", 4, Common.hsv(60, 50, 75), "Rupees used for special actions."){
public void onCollide(World world, Creature collider){
world.removeItem(collider.position.x, collider.position.y);
collider.gainRupees(1);
@@ -70,7 +71,7 @@ public void onCollide(World world, Creature collider){
}
public Item rupees_5(){
- Item item = new Item("rupees", 4, Tile.hsv(240, 50, 75), "Rupees used for special actions."){
+ Item item = new Item("rupees", 4, Common.hsv(240, 50, 75), "Rupees used for special actions."){
public void onCollide(World world, Creature collider){
world.removeItem(collider.position.x, collider.position.y);
collider.gainRupees(5);
View
4 src/iryrwarosh/MapExplorationHandler.java
@@ -23,9 +23,9 @@ public void handle(Message message) {
}
public void handle(Moved message) {
- if (message.creature.glyph() != '@')
+ if (!message.creature.isHuman())
return;
-
+
explored(message.world, message.creature);
}
View
51 src/iryrwarosh/RivalAi.java
@@ -9,12 +9,14 @@
protected List<Trait> scaryTraits;
private double explorationPercent;
+ private double talkativeness;
- public RivalAi(double explorationPercent){
+ public RivalAi(double explorationPercent, double talkativeness){
scaryTraits = Arrays.asList( Trait.POISONOUS, Trait.AGGRESSIVE, Trait.REACH_ATTACK,
Trait.DOUBLE_ATTACK, Trait.DOUBLE_MOVE, Trait.HUNTER);
this.explorationPercent = explorationPercent;
+ this.talkativeness = talkativeness;
}
public void update(World world, Creature self) {
@@ -67,7 +69,7 @@ private void goToNearestInterestingThing(World world, Creature self) {
if (self.hearts() < 5)
value--;
- if (other.glyph() == '@'){
+ if (other.isHuman()){
radius += 5;
if (self.hearts() > other.hearts())
@@ -178,12 +180,12 @@ private Point nextMove(Creature self, int[][] map1, int[][] map2){
frontiers.add(new Pair<Point,Point>(self.position, p));
Point current = null;
- int counter = 0;
+ int loops = 0;
while (frontiers.size() > 0){
Pair<Point,Point> pair = frontiers.remove(0);
current = pair.second;
- if (counter++ == 5000)
+ if (loops++ == 5000)
break;
if (current.x < 0 || current.y < 0 || current.x >= map1.length || current.y >= map1[0].length)
@@ -217,7 +219,10 @@ private Point nextMove(Creature self, int[][] map1, int[][] map2){
private Point walkBackToStartPoint(Point start, Point[][] parent, Point current) {
Point next = parent[current.x][current.y];
+ int loops = 0;
while (next != null){
+ if (loops++ == 1000)
+ return null;
if (next.x == start.x && next.y == start.y)
break;
current = next;
@@ -227,15 +232,39 @@ private Point walkBackToStartPoint(Point start, Point[][] parent, Point current)
}
public void handle(Creature self, Message message){
- if (Attacked.class.isAssignableFrom(message.getClass())){
- MessageBus.publish(new SaidOutLoud(self, "Ouch!"));
+ String text = null;
+ if (Attacked.class.isAssignableFrom(message.getClass()) && Math.random() < talkativeness){
+ Attacked attackedMessage = (Attacked)message;
+ if (attackedMessage.attacked == self){
+ if (attackedMessage.attacker.hasTrait(Trait.POISONOUS))
+ text = "Ah! Poisoned!";
+ else if (self.hearts() < 4)
+ text = "Ouch! I'm almost dead!";
+ else if (attackedMessage.attacker.isHuman())
+ text = "I'll get you for that " + attackedMessage.attacker.name() + "!";
+ else
+ text = "Ouch!";
+ } else if (attackedMessage.attacked.hasTrait(Trait.SPIKED)){
+ text = "Ouch! Spikes!";
+ } else if (attackedMessage.attacked.isMiniboss()){
+ text = "I'll save the people from you " + attackedMessage.attacked.name() + "!";
+ } else if (attackedMessage.attacked.isHuman()){
+ text = "I'm going to rule, not you " + attackedMessage.attacked.name() + "!";
+ }
}
- if (Killed.class.isAssignableFrom(message.getClass())){
- if (((Killed)message).attacked.isMiniboss())
- MessageBus.publish(new SaidOutLoud(self, "Die " + ((Killed)message).attacked.name() + "!"));
+ else if (Killed.class.isAssignableFrom(message.getClass()) && Math.random() < talkativeness){
+ Killed killedMessage = (Killed)message;
+ if (killedMessage.attacked.isHuman() && killedMessage.attacker == self)
+ text = "One fewer rival....";
+ else if (killedMessage.attacked == self && killedMessage.attacker.isHuman()){
+ text = "....I almost made it....";
+ }
}
- if (DiscoveredLostArtifact.class.isAssignableFrom(message.getClass())){
- MessageBus.publish(new SaidOutLoud(self, "Shiny!"));
+ else if (DiscoveredLostArtifact.class.isAssignableFrom(message.getClass()) && Math.random() < talkativeness){
+ text = "Shiny!";
}
+
+ if (text != null)
+ MessageBus.publish(new SaidOutLoud(self, text));
}
}
View
90 src/iryrwarosh/Tile.java
@@ -5,45 +5,45 @@
import asciiPanel.AsciiPanel;
public enum Tile {
- GREEN_DIRT (250, hsv(110, 50, 33), hsv(110, 50, 5), "dirt"),
- BROWN_DIRT (250, hsv( 45, 50, 33), hsv( 45, 50, 5), "dirt"),
- WHITE_DIRT (250, hsv( 0, 0, 33), hsv( 0, 50, 5), "dirt"),
- GREEN_TREE1 ( 6, hsv(100, 40, 55), hsv(110, 50, 5), "green tree"),
- GREEN_TREE2 ( 6, hsv(115, 40, 50), hsv(110, 50, 5), "green tree"),
- GREEN_TREE3 ( 6, hsv(130, 40, 45), hsv(110, 50, 5), "green tree"),
- PINE_TREE1 ( 30, hsv(100, 55, 40), hsv(110, 50, 5), "pine tree"),
- PINE_TREE2 ( 30, hsv(110, 50, 35), hsv(110, 50, 5), "pine tree"),
- PINE_TREE3 ( 30, hsv(120, 45, 30), hsv(110, 50, 5), "pine tree"),
- BROWN_TREE1 ( 6, hsv( 15, 55, 50), hsv( 30, 50, 5), "brown tree"),
- BROWN_TREE2 ( 6, hsv( 20, 55, 50), hsv( 30, 50, 5), "brown tree"),
- BROWN_TREE3 ( 6, hsv( 25, 55, 50), hsv( 30, 50, 5), "brown tree"),
- BROWN_TREE4 ( 5, hsv( 20, 75, 45), hsv( 30, 50, 5), "brown tree"),
- BROWN_TREE5 ( 5, hsv( 20, 70, 50), hsv( 30, 50, 5), "brown tree"),
- BROWN_TREE6 ( 5, hsv( 20, 65, 55), hsv( 30, 50, 5), "brown tree"),
- WHITE_TREE1 ( 6, hsv( 0, 0, 55), hsv( 0, 50, 5), "white tree"),
- WHITE_TREE2 ( 6, hsv( 0, 0, 50), hsv( 0, 50, 5), "white tree"),
- WHITE_TREE3 ( 6, hsv( 0, 0, 45), hsv( 0, 50, 5), "white tree"),
- GREEN_ROCK (177, hsv(110, 50, 15), hsv(110, 50, 50), "hill rock"),
- BROWN_ROCK (177, hsv( 30, 50, 15), hsv( 30, 50, 50), "mountain rock"),
- WHITE_ROCK (177, hsv( 0, 0, 15), hsv( 0, 0, 50), "white rock"),
- DESERT_SAND1(250, hsv( 60, 50, 55), hsv( 45, 50, 11), "desert sand"),
- DESERT_SAND2(250, hsv( 60, 50, 50), hsv( 45, 50, 10), "desert sand"),
- DESERT_SAND3(250, hsv( 60, 50, 45), hsv( 45, 50, 9), "desert sand"),
- WATER1 (247, hsv(210, 63, 80), hsv(210, 80, 21), "water"),
- WATER2 (247, hsv(210, 66, 75), hsv(210, 80, 20), "water"),
- WATER3 (247, hsv(210, 69, 70), hsv(210, 80, 19), "water"),
- BRIDGE (240, hsv( 30, 66, 66), hsv( 30, 90, 20), "bridge"),
- STATUE ('&', hsv( 20, 33, 90), hsv( 0, 0, 5), "statue"),
- LAVA1 (247, hsv( 0, 64, 79), hsv( 0, 75, 22), "lava"),
- LAVA2 (247, hsv( 0, 66, 75), hsv( 0, 75, 20), "lava"),
- LAVA3 (247, hsv( 0, 68, 71), hsv( 0, 75, 18), "lava"),
- OUT_OF_BOUNDS ('x', AsciiPanel.brightBlack, AsciiPanel.black, "OUT OF BOUNDS"),;
+ WHITE_WALL (' ', Common.hsv( 0, 0, 0), Common.hsv( 0, 0, 40), "wall"),
+ WHITE_TILE1 (' ', Common.hsv( 0, 0, 0), Common.hsv( 0, 0, 8), "tile"),
+ WHITE_TILE2 (' ', Common.hsv( 0, 0, 0), Common.hsv( 0, 0, 10), "tile"),
+ GREEN_DIRT (250, Common.hsv(110, 50, 33), Common.hsv(110, 50, 5), "dirt"),
+ BROWN_DIRT (250, Common.hsv( 45, 50, 33), Common.hsv( 45, 50, 5), "dirt"),
+ WHITE_DIRT (250, Common.hsv( 0, 0, 33), Common.hsv( 0, 0, 5), "dirt"),
+ GREEN_TREE1 ( 6, Common.hsv(100, 40, 55), Common.hsv(110, 50, 5), "green tree"),
+ GREEN_TREE2 ( 6, Common.hsv(115, 40, 50), Common.hsv(110, 50, 5), "green tree"),
+ GREEN_TREE3 ( 6, Common.hsv(130, 40, 45), Common.hsv(110, 50, 5), "green tree"),
+ PINE_TREE1 ( 30, Common.hsv(100, 55, 40), Common.hsv(110, 50, 5), "pine tree"),
+ PINE_TREE2 ( 30, Common.hsv(110, 50, 35), Common.hsv(110, 50, 5), "pine tree"),
+ PINE_TREE3 ( 30, Common.hsv(120, 45, 30), Common.hsv(110, 50, 5), "pine tree"),
+ BROWN_TREE1 ( 6, Common.hsv( 15, 55, 50), Common.hsv( 30, 50, 5), "brown tree"),
+ BROWN_TREE2 ( 6, Common.hsv( 20, 55, 50), Common.hsv( 30, 50, 5), "brown tree"),
+ BROWN_TREE3 ( 6, Common.hsv( 25, 55, 50), Common.hsv( 30, 50, 5), "brown tree"),
+ BROWN_TREE4 ( 5, Common.hsv( 20, 75, 45), Common.hsv( 30, 50, 5), "brown tree"),
+ BROWN_TREE5 ( 5, Common.hsv( 20, 70, 50), Common.hsv( 30, 50, 5), "brown tree"),
+ BROWN_TREE6 ( 5, Common.hsv( 20, 65, 55), Common.hsv( 30, 50, 5), "brown tree"),
+ WHITE_TREE1 ( 6, Common.hsv( 0, 0, 55), Common.hsv( 0, 0, 5), "white tree"),
+ WHITE_TREE2 ( 6, Common.hsv( 0, 0, 50), Common.hsv( 0, 0, 5), "white tree"),
+ WHITE_TREE3 ( 6, Common.hsv( 0, 0, 45), Common.hsv( 0, 0, 5), "white tree"),
+ GREEN_ROCK (177, Common.hsv(110, 50, 15), Common.hsv(110, 50, 50), "hill rock"),
+ BROWN_ROCK (177, Common.hsv( 30, 50, 15), Common.hsv( 30, 50, 50), "mountain rock"),
+ WHITE_ROCK (177, Common.hsv( 0, 0, 15), Common.hsv( 0, 0, 50), "white rock"),
+ DESERT_SAND1(250, Common.hsv( 60, 50, 55), Common.hsv( 45, 50, 11), "desert sand"),
+ DESERT_SAND2(250, Common.hsv( 60, 50, 50), Common.hsv( 45, 50, 10), "desert sand"),
+ DESERT_SAND3(250, Common.hsv( 60, 50, 45), Common.hsv( 45, 50, 9), "desert sand"),
+ WATER1 (247, Common.hsv(210, 63, 80), Common.hsv(210, 80, 21), "water"),
+ WATER2 (247, Common.hsv(210, 66, 75), Common.hsv(210, 80, 20), "water"),
+ WATER3 (247, Common.hsv(210, 69, 70), Common.hsv(210, 80, 19), "water"),
+ BRIDGE (240, Common.hsv( 30, 66, 66), Common.hsv( 30, 90, 20), "bridge"),
+ STATUE ('&', Common.hsv( 20, 33, 90), Common.hsv( 0, 0, 5), "statue"),
+ STATUE_WHITE('&', Common.hsv( 0, 0, 66), Common.hsv( 0, 0, 5), "statue"),
+ LAVA1 (247, Common.hsv( 0, 64, 79), Common.hsv( 0, 75, 22), "lava"),
+ LAVA2 (247, Common.hsv( 0, 66, 75), Common.hsv( 0, 75, 20), "lava"),
+ LAVA3 (247, Common.hsv( 0, 68, 71), Common.hsv( 0, 75, 18), "lava"),
+ OUT_OF_BOUNDS ('x', AsciiPanel.brightBlack, AsciiPanel.black, "OUT OF BOUNDS");
- public static Color hsv(int h, int s, int v){
- return Color.getHSBColor(h / 360f, s / 100f, v / 100f);
- }
-
- public Tile variation(){
+ public Tile variation(int x, int y){
Tile[] varieties = null;
switch (this){
@@ -87,6 +87,12 @@ public Tile variation(){
case DESERT_SAND3:
varieties = new Tile[]{ DESERT_SAND1, DESERT_SAND2, DESERT_SAND3 };
break;
+ case WHITE_TILE1:
+ case WHITE_TILE2:
+ if ((x+y) % 2 == 0)
+ return WHITE_TILE1;
+ else
+ return WHITE_TILE2;
}
if (varieties == null)
@@ -122,7 +128,7 @@ public boolean isWater() {
public boolean isGround() {
return this == GREEN_DIRT || this == BROWN_DIRT || this == WHITE_DIRT
|| this == DESERT_SAND1 || this == DESERT_SAND2 || this == DESERT_SAND3
- || this == BRIDGE;
+ || this == BRIDGE || this == WHITE_TILE1 || this == WHITE_TILE2;
}
public boolean isSwimmable() {
@@ -130,10 +136,14 @@ public boolean isSwimmable() {
}
public boolean isFlyable(){
- return this != OUT_OF_BOUNDS;
+ return this != OUT_OF_BOUNDS && this != WHITE_WALL;
}
public boolean isLava() {
return this == LAVA1 || this == LAVA2 || this == LAVA3;
}
+
+ public boolean canHideIn() {
+ return this.isFlyable() && this != WHITE_TILE1 && this != WHITE_TILE2;
+ }
}
View
2  src/iryrwarosh/Trait.java
@@ -6,7 +6,7 @@
DOUBLE_ATTACK("double attack"), DOUBLE_MOVE("double move"),
SPIKED("spiked"), REGENERATES("regenerates"), POISONOUS("poisonous"), CAMOUFLAGED("camouflaged"),
AGGRESSIVE("aggressive"), HIDER("hider"), TERRITORIAL("territorial"), ROCK_SPITTER("rock spitter"),
- SOCIAL("social"), FEARFUL("fearful"), LOOTLESS("lootless"),
+ SOCIAL("social"), LOOTLESS("lootless"),
EVADE_ATTACK("evasive attacker"), COUNTER_ATTACK("counter attack"),
REACH_ATTACK("long reach"), DETECT_CAMOUFLAGED("perceptive"),
DEFLECT_RANGED("deflects projectiles"), DEFLECT_MELEE("blocks melee"),
View
44 src/iryrwarosh/World.java
@@ -11,6 +11,7 @@
public List<Creature> creatures() { return creatures; }
private Item[][] items;
+ private List<Item> itemList;
private List<Projectile> projectiles;
public List<Projectile> projectiles() { return projectiles; }
@@ -24,6 +25,7 @@ public World(Tile[][] tiles, WorldMap map){
this.map = map;
this.creatures = new ArrayList<Creature>();
this.items = new Item[tiles.length][tiles[0].length];
+ this.itemList = new ArrayList<Item>();
this.projectiles = new ArrayList<Projectile>();
}
@@ -57,6 +59,11 @@ public void update(){
updateLava();
updateWater();
+ List<Item> itemsToUpdate = new ArrayList<Item>();
+ itemsToUpdate.addAll(itemList);
+ for (Item item : itemsToUpdate)
+ item.update(this, null);
+
List<Projectile> stillFlying = new ArrayList<Projectile>();
for (Projectile p : projectiles){
p.checkForCollision(this);
@@ -97,7 +104,7 @@ private void updateLava() {
if (Math.random() < 0.75)
continue;
- tiles[x][y] = Tile.LAVA1.variation();
+ tiles[x][y] = Tile.LAVA1.variation(x, y);
}
}
@@ -110,7 +117,7 @@ private void updateWater(){
if (x < tiles.length-1 && tiles[x+1][y].isWater())
tiles[x][y] = tiles[x+1][y];
else
- tiles[x][y] = Tile.WATER1.variation();
+ tiles[x][y] = Tile.WATER1.variation(x, y);
}
}
@@ -119,6 +126,9 @@ public void add(Creature creature) {
int x = (int)(Math.random() * tiles.length);
int y = (int)(Math.random() * tiles[0].length);
+ if (creature.isHuman() && map.screen(x/19, y/9).defaultGround == Tile.DESERT_SAND1)
+ continue; // too crowded in the deserts
+
if (creature.canEnter(tile(x,y)) && creature(x,y) == null)
creature.position = new Point(x, y);
}
@@ -145,25 +155,22 @@ public void addToScreen(Item item, int sx, int sy) {
continue;
items[x][y] = item;
+ itemList.add(item);
break;
}
}
public void add(Item item, int x, int y){
- ArrayList<Point> candidates = new ArrayList<Point>();
- candidates.add(new Point(x,y));
-
- int tries = 0;
- while (candidates.size() > 0 && tries++ < 25){
- Point dest = candidates.remove(0);
-
- if (item(dest.x, dest.y) == null && tile(dest.x, dest.y).isGround()){
- items[dest.x][dest.y] = item;
- return;
- } else {
- candidates.addAll(dest.neighbors());
- }
- }
+ if (item == null || x < 0 || y < 0 || x >= items.length || y >= items[0].length)
+ return;
+
+ removeItem(x, y);
+
+ items[x][y] = item;
+ itemList.add(item);
+ Creature here = creature(x, y);
+ if (here != null && here.hearts() > 0)
+ item.onCollide(this, here);
}
public void add(Item item) {
@@ -175,9 +182,14 @@ public void add(Item item) {
y = (int)(Math.random() * tiles[0].length);
}
items[x][y] = item;
+ itemList.add(item);
}
public void removeItem(int x, int y) {
+ if (items[x][y] == null)
+ return;
+
+ itemList.remove(items[x][y]);
items[x][y] = null;
}
View
227 src/iryrwarosh/Worldgen.java
@@ -359,18 +359,33 @@ private boolean isDeadEnd(int sx, int sy) {
}
private void setDeadEndTiles(int sx, int sy){
+ Tile liquid = Math.random() < 0.66 ? Tile.WATER1 : Tile.LAVA1;
+
+ if (Math.random() < 0.33){
+ cells[sx][sy].defaultGround = Tile.WHITE_TILE1;
+ cells[sx][sy].defaultWall = Tile.WHITE_WALL;
+ }
+
+ Tile random = getRandomWall();
switch ((int)(Math.random() * 10)){
case 0:
+ case 1: random = Tile.WATER1; break;
+ case 2:
+ case 3: random = Tile.LAVA1; break;
+ case 4: random = Tile.STATUE; break;
+ }
+ switch ((int)(Math.random() * 20)){
+ case 0:
addMap(sx, sy,
"###################"
+ "#.................#"
- + "#.#.~~~~~t~~~~~.#.#"
- + "#...~~.......~~...#"
- + "#.~~~.........~~~.#"
- + "#...~~.......~~...#"
- + "#.#.~~~~~t~~~~~.#.#"
+ + "#.#.ttttt=ttttt.#.#"
+ + "#...tt.......tt...#"
+ + "#.ttt.........ttt.#"
+ + "#...tt.......tt...#"
+ + "#.#.ttttt=ttttt.#.#"
+ "#.................#"
- + "###################", Tile.BRIDGE);
+ + "###################", liquid);
break;
case 1:
addMap(sx, sy,
@@ -382,19 +397,19 @@ private void setDeadEndTiles(int sx, int sy){
+ "#.t.............t.#"
+ "#.ttttttt.ttttttt.#"
+ "#.................#"
- + "###################", Tile.STATUE);
+ + "###################", random);
break;
case 2:
addMap(sx, sy,
"###################"
+ "#.................#"
- + "# .~~~~~~t~~~~~~..#"
- + "#.~~~~~~...~~~~~~.#"
- + "#.t.............t.#"
- + "#.~~~~~~...~~~~~~.#"
- + "#..~~~~~~t~~~~~~..#"
+ + "# .tttttt=tttttt..#"
+ + "#.tttttt...tttttt.#"
+ + "#.=.............=.#"
+ + "#.tttttt...tttttt.#"
+ + "#..tttttt=tttttt..#"
+ "#.................#"
- + "###################", Tile.BRIDGE);
+ + "###################", liquid);
break;
case 3:
addMap(sx, sy,
@@ -402,23 +417,23 @@ private void setDeadEndTiles(int sx, int sy){
+ "#.................#"
+ "#..ttt.......ttt..#"
+ "#.tt...........tt.#"
- + "#........t........#"
+ + "#.......t.t.......#"
+ "#.tt...........tt.#"
+ "#..ttt.......ttt..#"
+ "#.................#"
- + "###################", Tile.LAVA1);
+ + "###################", random);
break;
case 4:
addMap(sx, sy,
- "ttttttttttttttttttt"
- + "tttttt.......tttttt"
+ "##ttttttttttttttt##"
+ + "#ttttt.......ttttt#"
+ "tt.....t...t.....tt"
+ "t..t..tt...tt..t..t"
+ "t.ttt.........ttt.t"
+ "t..t..tt...tt..t..t"
+ "tt.....t...t.....tt"
- + "tttttt.......tttttt"
- + "ttttttttttttttttttt", Tile.LAVA1);
+ + "#ttttt.......ttttt#"
+ + "##ttttttttttttttt##", liquid);
break;
case 5:
addMap(sx, sy,
@@ -438,11 +453,11 @@ private void setDeadEndTiles(int sx, int sy){
+ "####...........####"
+ "##....t..t..t....##"
+ "#...t.........t...#"
- + "#.t......t......t.#"
+ + "#.t.....t.t.....t.#"
+ "#...t.........t...#"
+ "##....t..t..t....##"
+ "####...........####"
- + "###################", Tile.STATUE);
+ + "###################", random);
break;
case 7:
cells[sx][sy].defaultGround = Tile.DESERT_SAND1;
@@ -461,26 +476,146 @@ private void setDeadEndTiles(int sx, int sy){
case 8:
addMap(sx, sy,
"###################"
- + "#~~~~~~~~.~~~~~~~~#"
- + "#~~~~~~~~t~~~~~~~~#"
- + "#~~~~~~~...~~~~~~~#"
- + "#......t...t......#"
- + "#~~~~~~~...~~~~~~~#"
- + "#~~~~~~~~t~~~~~~~~#"
- + "#~~~~~~~~.~~~~~~~~#"
- + "###################", Tile.BRIDGE);
+ + "#tttttttt.tttttttt#"
+ + "#tttttttt=tttttttt#"
+ + "#ttttttt...ttttttt#"
+ + "#......=...=......#"
+ + "#ttttttt...ttttttt#"
+ + "#tttttttt=tttttttt#"
+ + "#tttttttt.tttttttt#"
+ + "###################", liquid);
break;
case 9:
addMap(sx, sy,
- "ttttttttttttttttttt"
- + "tttt...........tttt"
+ "##ttttttttttttttt##"
+ + "#ttt...........ttt#"
+ "tt...............tt"
+ "t......ttttt......t"
+ "t.....ttttttt.....t"
+ "t......ttttt......t"
+ "tt...............tt"
- + "tttt...........tttt"
- + "ttttttttttttttttttt", Tile.LAVA1);
+ + "#ttt...........ttt#"
+ + "##ttttttttttttttt##", liquid);
+ break;
+ case 10:
+ addMap(sx, sy,
+ "###################"
+ + "###.............###"
+ + "##.....ttttt.....##"
+ + "#.....tt#t#tt.....#"
+ + "#.....ttttttt.....#"
+ + "#.....tt#t#tt.....#"
+ + "##.....ttttt.....##"
+ + "###.............###"
+ + "###################", liquid);
+ break;
+ case 11:
+ addMap(sx, sy,
+ "###################"
+ + "#.................#"
+ + "#.tt=ttttttttt=tt.#"
+ + "#.t.............t.#"
+ + "#.t.&.........&.t.#"
+ + "#.t.............t.#"
+ + "#.tt=ttttttttt=tt.#"
+ + "#.................#"
+ + "###################", liquid);
+ break;
+ case 12:
+ addMap(sx, sy,
+ "###################"
+ + "##...............##"
+ + "#...ttttttttttt...#"
+ + "#.tttttt...tttttt.#"
+ + "#.tttttt...tttttt.#"
+ + "#.tttttt...tttttt.#"
+ + "#...ttttt=ttttt...#"
+ + "##...............##"
+ + "###################", liquid);
+ break;
+ case 13:
+ addMap(sx, sy,
+ "###################"
+ + "#.................#"
+ + "#.&.&.&.&.&.&.&.&.#"
+ + "#..tttttt=tttttt..#"
+ + "#.&t...........t&.#"
+ + "#..tttttt=tttttt..#"
+ + "#.&.&.&.&.&.&.&.&.#"
+ + "#.................#"
+ + "###################", liquid);
+ break;
+ case 14:
+ addMap(sx, sy,
+ "###################"
+ + "####x.........x####"
+ + "##x.............x##"
+ + "#x...............x#"
+ + "#x.....x...x.....x#"
+ + "#x...............x#"
+ + "##x.............x##"
+ + "####x.........x####"
+ + "###################");
+ break;
+ case 15:
+ addMap(sx, sy,
+ "###################"
+ + "#tt.............tt#"
+ + "#tt.ttt.....ttt.tt#"
+ + "#...txt.....txt...#"
+ + "#.tttxt.....txttt.#"
+ + "#...txt.....txt...#"
+ + "#tt.ttt.....ttt.tt#"
+ + "#tt.............tt#"
+ + "###################", liquid);
+ break;
+ case 16:
+ addMap(sx, sy,
+ "#ttttttttttttttttt#"
+ + "t...t...t..t..t...t"
+ + "t...=...t..t..=...t"
+ + "t...t...t==t..t...t"
+ + "ttt=ttt==..==tt=ttt"
+ + "t...t...t==t..t...t"
+ + "t...=...t..t..=...t"
+ + "t...t...t..t..t...t"
+ + "#ttttttttttttttttt#", liquid);
+ break;
+ case 17:
+ addMap(sx, sy,
+ "###################"
+ + "##tt.....=.....tt##"
+ + "#tttttttt=tttttttt#"
+ + "#ttttttt...ttttttt#"
+ + "#=======...=======#"
+ + "#ttttttt...ttttttt#"
+ + "#tttttttt=tttttttt#"
+ + "##tt.....=.....tt##"
+ + "###################", liquid);
+ break;
+ case 18:
+ addMap(sx, sy,
+ "###################"
+ + "#..&...&...&...&..#"
+ + "#&...x...x...x...&#"
+ + "#..x...x...x...x..#"
+ + "#&...x.......x...&#"
+ + "#..x...x...x...x..#"
+ + "#&...x...x...x...&#"
+ + "#..&...&...&...&..#"
+ + "###################");
+ break;
+ case 19:
+ addMap(sx, sy,
+ "###################"
+ + "##.x.x.x...x.x.x.##"
+ + "#.ttttttt=ttttttt.#"
+ + "#xt.............tx#"
+ + "#.=.............=.#"
+ + "#xt.............tx#"
+ + "#.ttttttt=ttttttt.#"
+ + "##.x.x.x...x.x.x.##"
+ + "###################");
break;
}
@@ -756,7 +891,7 @@ private void setTilesInnerScreen(int sx, int sy){
+ " "
+ " "
+ " .&.x.#.#.x.&. "
- + " .&.x.#.#.x.&. "
+ + " ............. "
+ " .&.x.#.#.x.&. "
+ " "
+ " "
@@ -842,13 +977,13 @@ private void setTilesOuterScreen(int sx, int sy){
case 6:
addMap(sx, sy,
"###################"
- + "####...........####"
+ + "###.............###"
+ "##...............##"
+ "#.. ..#"
+ "#.. ..#"
+ "#.. ..#"
+ "##...............##"
- + "####............###"
+ + "###.............###"
+ "###################");
break;
case 7:
@@ -1280,20 +1415,30 @@ private void addMap(int sx, int sy, String data, Tile specificTile) {
Tile floor = cells[sx][sy].defaultGround;
Tile wall = cells[sx][sy].defaultWall;
Tile local = Math.random() < 0.66 ? wall : getRandomWall();
+ Tile bridge = Tile.BRIDGE;
if (Math.random() < 0.025) local = Tile.STATUE;
Tile special = Math.random() < 0.10 ? Tile.STATUE : (Math.random() < 0.50 ? floor : wall);
+ if (wall == Tile.WHITE_WALL){
+ local = Tile.STATUE_WHITE;
+ special = Tile.STATUE_WHITE;
+ bridge = Tile.WHITE_TILE1;
+ if (specificTile != Tile.WATER1 && specificTile != Tile.LAVA1 && specificTile != Tile.BRIDGE)
+ specificTile = Tile.STATUE_WHITE;
+ }
+
for (int x = 0; x < screenWidth; x++)
for (int y = 0; y < screenHeight; y++) {
switch (data.charAt(x + y * screenWidth)){
- case '.': tiles[mx+x][my+y] = floor.variation(); break;
- case '#': tiles[mx+x][my+y] = wall.variation(); break;
- case 'x': tiles[mx+x][my+y] = local.variation(); break;
- case '~': tiles[mx+x][my+y] = Tile.WATER1.variation(); break;
+ case '.': tiles[mx+x][my+y] = floor.variation(mx+x, my+y); break;
+ case '#': tiles[mx+x][my+y] = wall.variation(mx+x, my+y); break;
+ case 'x': tiles[mx+x][my+y] = local.variation(mx+x, my+y); break;
+ case '~': tiles[mx+x][my+y] = Tile.WATER1.variation(mx+x, my+y); break;
case '&': tiles[mx+x][my+y] = special; break;
case 't': tiles[mx+x][my+y] = specificTile; break;
+ case '=': tiles[mx+x][my+y] = bridge.variation(mx+x, my+y); break;
case ' ': break;
}
}
@@ -1351,7 +1496,7 @@ private void clear(int x, int y, int w, int h, Tile tile) {
for (int x2 = x; x2 < x + w; x2++)
for (int y2 = y; y2 < y + h; y2++)
if (x2 >= 0 && y2 >= 0 && x2 < tiles.length && y2 < tiles[0].length)
- tiles[x2][y2] = tile.variation();
+ tiles[x2][y2] = tile.variation(x2, y2);
}
public void addLakeToTiles(){
View
87 src/iryrwarosh/screens/CastAdvancedSpellScreen.java
@@ -1,87 +0,0 @@
-package iryrwarosh.screens;
-
-import iryrwarosh.Creature;
-import iryrwarosh.Point;
-import iryrwarosh.Projectile;
-import iryrwarosh.Tile;
-import iryrwarosh.Trait;
-import iryrwarosh.World;
-
-import java.awt.event.KeyEvent;
-
-import asciiPanel.AsciiPanel;
-
-public class CastAdvancedSpellScreen implements Screen {
- private Screen previous;
- private World world;
- private Creature player;
-
- public CastAdvancedSpellScreen(Screen previous, World world, Creature player){
- this.previous = previous;
- this.world = world;
- this.player = player;
- }
-
- @Override
- public void displayOutput(AsciiPanel terminal) {
- previous.displayOutput(terminal);
-
- terminal.clear(' ', 1, 20, 31, 4);
- terminal.write("What do you want to cast?", 1, 20);
- terminal.write(" [1] Magic Missiles cost 10", 1, 21)
- .write((char)4, Tile.hsv(60, 25, 75));
- terminal.write(" [2] Summon imp cost 15", 1, 22)
- .write((char)4, Tile.hsv(60, 25, 75));
- terminal.write(" [3] Mutate self cost 20", 1, 23)
- .write((char)4, AsciiPanel.red);
- }
-
- @Override
- public Screen respondToUserInput(KeyEvent key) {
- switch (key.getKeyChar()){
- case '1': magicMissiles(); break;
- case '2': summonImp(); break;
- case '3': mutateSelf(); break;
- }
-
- return previous;
- }
-
- private void magicMissiles() {
- world.add(new Projectile("magic missile", player, 7, Tile.hsv(210, 33, 66), 2, player.position.plus(1, 0), new Point( 1, 0)));
- world.add(new Projectile("magic missile", player, 7, Tile.hsv(210, 33, 66), 2, player.position.plus(-1, 0), new Point(-1, 0)));
- world.add(new Projectile("magic missile", player, 7, Tile.hsv(210, 33, 66), 2, player.position.plus(0, 1), new Point( 0, 1)));
- world.add(new Projectile("magic missile", player, 7, Tile.hsv(210, 33, 66), 2, player.position.plus(0,-1), new Point( 0,-1)));
- world.add(new Projectile("magic missile", player, 7, Tile.hsv(210, 33, 66), 2, player.position.plus(-1,-1), new Point(-1,-1)));
- world.add(new Projectile("magic missile", player, 7, Tile.hsv(210, 33, 66), 2, player.position.plus(-1, 1), new Point(-1, 1)));
- world.add(new Projectile("magic missile", player, 7, Tile.hsv(210, 33, 66), 2, player.position.plus(1,-1), new Point( 1,-1)));