cleaned up formatting:
- removed trailing whitespace - changed all leading whitespace to tabs - removed IDE created author comments
This commit is contained in:
parent
baa83b7e43
commit
cebdff0221
|
@ -5,20 +5,20 @@
|
|||
android:versionName="0.3.0d"
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="8"
|
||||
android:targetSdkVersion="21"/>
|
||||
android:minSdkVersion="8"
|
||||
android:targetSdkVersion="21"/>
|
||||
|
||||
<uses-feature
|
||||
android:glEsVersion="0x00020000"/>
|
||||
android:glEsVersion="0x00020000"/>
|
||||
|
||||
<supports-screens
|
||||
android:smallScreens="false"
|
||||
android:normalScreens="true"
|
||||
android:largeScreens="true"/>
|
||||
<!--android:xlargeScreens="true"-->
|
||||
android:smallScreens="false"
|
||||
android:normalScreens="true"
|
||||
android:largeScreens="true"/>
|
||||
<!--android:xlargeScreens="true"-->
|
||||
|
||||
<application
|
||||
android:icon="@drawable/ic_launcher"
|
||||
|
|
|
@ -40,7 +40,7 @@ public class Assets {
|
|||
public static final String ROGUE = "rogue.png";
|
||||
public static final String HUNTRESS = "ranger.png";
|
||||
public static final String AVATARS = "avatars.png";
|
||||
public static final String PET = "pet.png";
|
||||
public static final String PET = "pet.png";
|
||||
|
||||
public static final String SURFACE = "surface.png";
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ public class Badges {
|
|||
GAMES_PLAYED_3( "500 games played", 62, true ),
|
||||
GAMES_PLAYED_4( "2000 games played", 63, true ),
|
||||
HAPPY_END( "Happy end", 38 ),
|
||||
CHAMPION( "Challenge won", 39, true ),
|
||||
CHAMPION( "Challenge won", 39, true ),
|
||||
SUPPORTER( "Thanks for your support!", 31, true );
|
||||
|
||||
public boolean meta;
|
||||
|
@ -402,7 +402,7 @@ public class Badges {
|
|||
// 2) When an item is upgraded (ScrollOfUpgrade, ScrollOfWeaponUpgrade, ShortSword, WandOfMagicMissile)
|
||||
// 3) When an item is identified
|
||||
|
||||
// Note that artifacts should never trigger this badge as they are alternatively upgraded
|
||||
// Note that artifacts should never trigger this badge as they are alternatively upgraded
|
||||
if (!item.levelKnown || item instanceof Artifact) {
|
||||
return;
|
||||
}
|
||||
|
@ -717,7 +717,7 @@ public class Badges {
|
|||
}
|
||||
}
|
||||
|
||||
//TODO: Replace this badge, delayed until an eventual badge rework
|
||||
//TODO: Replace this badge, delayed until an eventual badge rework
|
||||
public static void validateRingOfHaggler() {
|
||||
if (!local.contains( Badge.RING_OF_HAGGLER )/* && new RingOfThorns().isKnown()*/) {
|
||||
Badge badge = Badge.RING_OF_HAGGLER;
|
||||
|
@ -726,7 +726,7 @@ public class Badges {
|
|||
}
|
||||
}
|
||||
|
||||
//TODO: Replace this badge, delayed until an eventual badge rework
|
||||
//TODO: Replace this badge, delayed until an eventual badge rework
|
||||
public static void validateRingOfThorns() {
|
||||
if (!local.contains( Badge.RING_OF_THORNS )/* && new RingOfThorns().isKnown()*/) {
|
||||
Badge badge = Badge.RING_OF_THORNS;
|
||||
|
@ -854,9 +854,9 @@ public class Badges {
|
|||
displayBadge( Badge.HAPPY_END );
|
||||
}
|
||||
|
||||
public static void validateChampion() {
|
||||
displayBadge(Badge.CHAMPION);
|
||||
}
|
||||
public static void validateChampion() {
|
||||
displayBadge(Badge.CHAMPION);
|
||||
}
|
||||
|
||||
private static void displayBadge( Badge badge ) {
|
||||
|
||||
|
|
|
@ -46,13 +46,13 @@ public class Bones {
|
|||
|
||||
public static void leave() {
|
||||
|
||||
depth = Dungeon.depth;
|
||||
depth = Dungeon.depth;
|
||||
|
||||
//heroes which have won the game, who die far above their farthest depth, or who are challenged drop no bones.
|
||||
if (Statistics.amuletObtained || (Statistics.deepestFloor - 5) >= depth || Dungeon.challenges > 0) {
|
||||
depth = -1;
|
||||
return;
|
||||
}
|
||||
//heroes which have won the game, who die far above their farthest depth, or who are challenged drop no bones.
|
||||
if (Statistics.amuletObtained || (Statistics.deepestFloor - 5) >= depth || Dungeon.challenges > 0) {
|
||||
depth = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
item = pickItem(Dungeon.hero);
|
||||
|
||||
|
@ -69,59 +69,59 @@ public class Bones {
|
|||
}
|
||||
}
|
||||
|
||||
private static Item pickItem(Hero hero){
|
||||
Item item = null;
|
||||
if (Random.Int(2) == 0) {
|
||||
switch (Random.Int(5)) {
|
||||
case 0:
|
||||
item = hero.belongings.weapon;
|
||||
break;
|
||||
case 1:
|
||||
item = hero.belongings.armor;
|
||||
break;
|
||||
case 2:
|
||||
item = hero.belongings.misc1;
|
||||
break;
|
||||
case 3:
|
||||
item = hero.belongings.misc2;
|
||||
break;
|
||||
case 4:
|
||||
item = Dungeon.quickslot.randomNonePlaceholder();
|
||||
break;
|
||||
}
|
||||
if (item != null && !item.bones)
|
||||
return pickItem(hero);
|
||||
} else {
|
||||
private static Item pickItem(Hero hero){
|
||||
Item item = null;
|
||||
if (Random.Int(2) == 0) {
|
||||
switch (Random.Int(5)) {
|
||||
case 0:
|
||||
item = hero.belongings.weapon;
|
||||
break;
|
||||
case 1:
|
||||
item = hero.belongings.armor;
|
||||
break;
|
||||
case 2:
|
||||
item = hero.belongings.misc1;
|
||||
break;
|
||||
case 3:
|
||||
item = hero.belongings.misc2;
|
||||
break;
|
||||
case 4:
|
||||
item = Dungeon.quickslot.randomNonePlaceholder();
|
||||
break;
|
||||
}
|
||||
if (item != null && !item.bones)
|
||||
return pickItem(hero);
|
||||
} else {
|
||||
|
||||
Iterator<Item> iterator = hero.belongings.backpack.iterator();
|
||||
Item curItem;
|
||||
ArrayList<Item> items = new ArrayList<Item>();
|
||||
while (iterator.hasNext()){
|
||||
curItem = iterator.next();
|
||||
if (curItem.bones)
|
||||
items.add(curItem);
|
||||
}
|
||||
Iterator<Item> iterator = hero.belongings.backpack.iterator();
|
||||
Item curItem;
|
||||
ArrayList<Item> items = new ArrayList<Item>();
|
||||
while (iterator.hasNext()){
|
||||
curItem = iterator.next();
|
||||
if (curItem.bones)
|
||||
items.add(curItem);
|
||||
}
|
||||
|
||||
if (Random.Int(3) < items.size()) {
|
||||
item = Random.element(items);
|
||||
if (item.stackable){
|
||||
if (item instanceof MissileWeapon){
|
||||
item.quantity(Random.NormalIntRange(1, item.quantity()));
|
||||
} else {
|
||||
item.quantity(Random.NormalIntRange(1, (item.quantity() + 1) / 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (item == null) {
|
||||
if (Dungeon.gold > 50) {
|
||||
item = new Gold( Random.NormalIntRange( 50, Dungeon.gold ) );
|
||||
} else {
|
||||
item = new Gold( 50 );
|
||||
}
|
||||
}
|
||||
return item;
|
||||
}
|
||||
if (Random.Int(3) < items.size()) {
|
||||
item = Random.element(items);
|
||||
if (item.stackable){
|
||||
if (item instanceof MissileWeapon){
|
||||
item.quantity(Random.NormalIntRange(1, item.quantity()));
|
||||
} else {
|
||||
item.quantity(Random.NormalIntRange(1, (item.quantity() + 1) / 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (item == null) {
|
||||
if (Dungeon.gold > 50) {
|
||||
item = new Gold( Random.NormalIntRange( 50, Dungeon.gold ) );
|
||||
} else {
|
||||
item = new Gold( 50 );
|
||||
}
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
public static Item get() {
|
||||
if (depth == -1) {
|
||||
|
@ -141,36 +141,36 @@ public class Bones {
|
|||
}
|
||||
|
||||
} else {
|
||||
//heroes who are challenged cannot find bones
|
||||
//heroes who are challenged cannot find bones
|
||||
if (depth == Dungeon.depth && Dungeon.challenges == 0) {
|
||||
Game.instance.deleteFile( BONES_FILE );
|
||||
depth = 0;
|
||||
|
||||
if (item instanceof Artifact){
|
||||
if (Generator.removeArtifact((Artifact)item)) {
|
||||
try {
|
||||
Artifact artifact = (Artifact)item.getClass().newInstance();
|
||||
artifact.cursed = true;
|
||||
artifact.cursedKnown = true;
|
||||
//caps displayed artifact level
|
||||
artifact.transferUpgrade(Math.min(
|
||||
item.visiblyUpgraded(),
|
||||
1 + ((Dungeon.depth * 3) / 10)));
|
||||
if (item instanceof Artifact){
|
||||
if (Generator.removeArtifact((Artifact)item)) {
|
||||
try {
|
||||
Artifact artifact = (Artifact)item.getClass().newInstance();
|
||||
artifact.cursed = true;
|
||||
artifact.cursedKnown = true;
|
||||
//caps displayed artifact level
|
||||
artifact.transferUpgrade(Math.min(
|
||||
item.visiblyUpgraded(),
|
||||
1 + ((Dungeon.depth * 3) / 10)));
|
||||
|
||||
return item;
|
||||
} catch (Exception e) {
|
||||
return new Gold(item.price());
|
||||
}
|
||||
} else {
|
||||
return new Gold(item.price());
|
||||
}
|
||||
}
|
||||
return item;
|
||||
} catch (Exception e) {
|
||||
return new Gold(item.price());
|
||||
}
|
||||
} else {
|
||||
return new Gold(item.price());
|
||||
}
|
||||
}
|
||||
|
||||
if (item.isUpgradable()) {
|
||||
item.cursed = true;
|
||||
item.cursedKnown = true;
|
||||
if (item.isUpgradable()) {
|
||||
//gain 1 level every 3.333 floors down plus one additional level.
|
||||
//gain 1 level every 3.333 floors down plus one additional level.
|
||||
int lvl = 1 + ((Dungeon.depth * 3) / 10);
|
||||
if (lvl < item.level) {
|
||||
item.degrade( item.level - lvl );
|
||||
|
@ -186,5 +186,5 @@ public class Bones {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,26 +19,26 @@ package com.shatteredpixel.shatteredpixeldungeon;
|
|||
|
||||
public class Challenges {
|
||||
|
||||
public static final int NO_FOOD = 1;
|
||||
public static final int NO_ARMOR = 2;
|
||||
public static final int NO_HEALING = 4;
|
||||
public static final int NO_HERBALISM = 8;
|
||||
public static final int SWARM_INTELLIGENCE = 16;
|
||||
public static final int DARKNESS = 32;
|
||||
public static final int NO_FOOD = 1;
|
||||
public static final int NO_ARMOR = 2;
|
||||
public static final int NO_HEALING = 4;
|
||||
public static final int NO_HERBALISM = 8;
|
||||
public static final int SWARM_INTELLIGENCE = 16;
|
||||
public static final int DARKNESS = 32;
|
||||
public static final int NO_SCROLLS = 64;
|
||||
|
||||
public static final String[] NAMES = {
|
||||
"On diet",
|
||||
"Faith is my armor",
|
||||
"Pharmacophobia",
|
||||
"Barren land",
|
||||
"Swarm intelligence",
|
||||
"Into darkness",
|
||||
"Forbidden runes"
|
||||
};
|
||||
public static final String[] NAMES = {
|
||||
"On diet",
|
||||
"Faith is my armor",
|
||||
"Pharmacophobia",
|
||||
"Barren land",
|
||||
"Swarm intelligence",
|
||||
"Into darkness",
|
||||
"Forbidden runes"
|
||||
};
|
||||
|
||||
public static final int[] MASKS = {
|
||||
NO_FOOD, NO_ARMOR, NO_HEALING, NO_HERBALISM, SWARM_INTELLIGENCE, DARKNESS, NO_SCROLLS
|
||||
};
|
||||
public static final int[] MASKS = {
|
||||
NO_FOOD, NO_ARMOR, NO_HEALING, NO_HERBALISM, SWARM_INTELLIGENCE, DARKNESS, NO_SCROLLS
|
||||
};
|
||||
|
||||
}
|
|
@ -73,45 +73,45 @@ public class Dungeon {
|
|||
|
||||
public static int transmutation; // depth number for a well of transmutation
|
||||
|
||||
//enum of items which have limited spawns, records how many have spawned
|
||||
//could all be their own separate numbers, but this allows iterating, much nicer for bundling/initializing.
|
||||
//enum of items which have limited spawns, records how many have spawned
|
||||
//could all be their own separate numbers, but this allows iterating, much nicer for bundling/initializing.
|
||||
public static enum limitedDrops{
|
||||
//limited world drops
|
||||
strengthPotions,
|
||||
upgradeScrolls,
|
||||
arcaneStyli,
|
||||
//limited world drops
|
||||
strengthPotions,
|
||||
upgradeScrolls,
|
||||
arcaneStyli,
|
||||
|
||||
//all unlimited health potion sources
|
||||
//all unlimited health potion sources
|
||||
swarmHP,
|
||||
batHP,
|
||||
warlockHP,
|
||||
scorpioHP,
|
||||
cookingHP,
|
||||
//blandfruit, which can technically be an unlimited health potion source
|
||||
//blandfruit, which can technically be an unlimited health potion source
|
||||
blandfruitSeed,
|
||||
|
||||
//doesn't use Generator, so we have to enforce one armband drop here
|
||||
//doesn't use Generator, so we have to enforce one armband drop here
|
||||
armband,
|
||||
|
||||
//containers
|
||||
dewVial,
|
||||
seedBag,
|
||||
scrollBag,
|
||||
potionBag,
|
||||
wandBag;
|
||||
//containers
|
||||
dewVial,
|
||||
seedBag,
|
||||
scrollBag,
|
||||
potionBag,
|
||||
wandBag;
|
||||
|
||||
public int count = 0;
|
||||
|
||||
//for items which can only be dropped once, should directly access count otherwise.
|
||||
public boolean dropped(){
|
||||
return count != 0;
|
||||
}
|
||||
public void drop(){
|
||||
count = 1;
|
||||
}
|
||||
//for items which can only be dropped once, should directly access count otherwise.
|
||||
public boolean dropped(){
|
||||
return count != 0;
|
||||
}
|
||||
public void drop(){
|
||||
count = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static int challenges;
|
||||
public static int challenges;
|
||||
|
||||
public static Hero hero;
|
||||
public static Level level;
|
||||
|
@ -130,17 +130,17 @@ public class Dungeon {
|
|||
|
||||
public static SparseArray<ArrayList<Item>> droppedItems;
|
||||
|
||||
public static int version;
|
||||
public static int version;
|
||||
|
||||
public static void init() {
|
||||
|
||||
version = Game.versionCode;
|
||||
challenges = ShatteredPixelDungeon.challenges();
|
||||
challenges = ShatteredPixelDungeon.challenges();
|
||||
|
||||
Generator.initArtifacts();
|
||||
Generator.initArtifacts();
|
||||
|
||||
Actor.clear();
|
||||
Actor.resetNextID();
|
||||
Actor.resetNextID();
|
||||
|
||||
PathFinder.setMapSize( Level.WIDTH, Level.HEIGHT );
|
||||
|
||||
|
@ -152,7 +152,7 @@ public class Dungeon {
|
|||
Journal.reset();
|
||||
|
||||
quickslot.reset();
|
||||
QuickSlotButton.reset();
|
||||
QuickSlotButton.reset();
|
||||
|
||||
depth = 0;
|
||||
gold = 0;
|
||||
|
@ -160,7 +160,7 @@ public class Dungeon {
|
|||
droppedItems = new SparseArray<ArrayList<Item>>();
|
||||
|
||||
for (limitedDrops a : limitedDrops.values())
|
||||
a.count = 0;
|
||||
a.count = 0;
|
||||
|
||||
transmutation = Random.IntRange( 6, 14 );
|
||||
|
||||
|
@ -181,9 +181,9 @@ public class Dungeon {
|
|||
StartScene.curClass.initHero( hero );
|
||||
}
|
||||
|
||||
public static boolean isChallenged( int mask ) {
|
||||
return (challenges & mask) != 0;
|
||||
}
|
||||
public static boolean isChallenged( int mask ) {
|
||||
return (challenges & mask) != 0;
|
||||
}
|
||||
|
||||
public static Level newLevel() {
|
||||
|
||||
|
@ -315,12 +315,12 @@ public class Dungeon {
|
|||
}
|
||||
|
||||
observe();
|
||||
try {
|
||||
saveAll();
|
||||
} catch (IOException e) {
|
||||
try {
|
||||
saveAll();
|
||||
} catch (IOException e) {
|
||||
/*This only catches IO errors. Yes, this means things can go wrong, and they can go wrong catastrophically.
|
||||
But when they do the user will get a nice 'report this issue' dialogue, and I can fix the bug.*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void dropToChasm( Item item ) {
|
||||
|
@ -372,23 +372,23 @@ public class Dungeon {
|
|||
private static final String RN_DEPTH_FILE = "ranger%d.dat";
|
||||
|
||||
private static final String VERSION = "version";
|
||||
private static final String CHALLENGES = "challenges";
|
||||
private static final String CHALLENGES = "challenges";
|
||||
private static final String HERO = "hero";
|
||||
private static final String GOLD = "gold";
|
||||
private static final String DEPTH = "depth";
|
||||
private static final String DROPPED = "dropped%d";
|
||||
private static final String LEVEL = "level";
|
||||
private static final String LIMDROPS = "limiteddrops";
|
||||
private static final String LIMDROPS = "limiteddrops";
|
||||
private static final String DV = "dewVial";
|
||||
private static final String WT = "transmutation";
|
||||
private static final String CHAPTERS = "chapters";
|
||||
private static final String QUESTS = "quests";
|
||||
private static final String BADGES = "badges";
|
||||
|
||||
//TODO: to support pre-0.2.3 saves, remove when needed
|
||||
private static final String POS = "potionsOfStrength";
|
||||
private static final String SOU = "scrollsOfEnhancement";
|
||||
private static final String AS = "arcaneStyli";
|
||||
//TODO: to support pre-0.2.3 saves, remove when needed
|
||||
private static final String POS = "potionsOfStrength";
|
||||
private static final String SOU = "scrollsOfEnhancement";
|
||||
private static final String AS = "arcaneStyli";
|
||||
|
||||
public static String gameFile( HeroClass cl ) {
|
||||
switch (cl) {
|
||||
|
@ -422,7 +422,7 @@ public class Dungeon {
|
|||
|
||||
version = Game.versionCode;
|
||||
bundle.put( VERSION, version );
|
||||
bundle.put( CHALLENGES, challenges );
|
||||
bundle.put( CHALLENGES, challenges );
|
||||
bundle.put( HERO, hero );
|
||||
bundle.put( GOLD, gold );
|
||||
bundle.put( DEPTH, depth );
|
||||
|
@ -435,10 +435,10 @@ public class Dungeon {
|
|||
|
||||
bundle.put( WT, transmutation );
|
||||
|
||||
int[] dropValues = new int[limitedDrops.values().length];
|
||||
for (limitedDrops value : limitedDrops.values())
|
||||
dropValues[value.ordinal()] = value.count;
|
||||
bundle.put ( LIMDROPS, dropValues );
|
||||
int[] dropValues = new int[limitedDrops.values().length];
|
||||
for (limitedDrops value : limitedDrops.values())
|
||||
dropValues[value.ordinal()] = value.count;
|
||||
bundle.put ( LIMDROPS, dropValues );
|
||||
|
||||
int count = 0;
|
||||
int ids[] = new int[chapters.size()];
|
||||
|
@ -458,13 +458,13 @@ public class Dungeon {
|
|||
|
||||
Statistics.storeInBundle( bundle );
|
||||
Journal.storeInBundle( bundle );
|
||||
Generator.storeInBundle( bundle );
|
||||
Generator.storeInBundle( bundle );
|
||||
|
||||
Scroll.save( bundle );
|
||||
Potion.save( bundle );
|
||||
Ring.save( bundle );
|
||||
|
||||
Actor.storeNextID( bundle );
|
||||
Actor.storeNextID( bundle );
|
||||
|
||||
Bundle badges = new Bundle();
|
||||
Badges.saveLocal( badges );
|
||||
|
@ -519,16 +519,16 @@ public class Dungeon {
|
|||
|
||||
Bundle bundle = gameBundle( fileName );
|
||||
|
||||
version = bundle.getInt( VERSION );
|
||||
version = bundle.getInt( VERSION );
|
||||
|
||||
Generator.reset();
|
||||
|
||||
Actor.restoreNextID( bundle );
|
||||
Actor.restoreNextID( bundle );
|
||||
|
||||
quickslot.reset();
|
||||
QuickSlotButton.reset();
|
||||
QuickSlotButton.reset();
|
||||
|
||||
Dungeon.challenges = bundle.getInt( CHALLENGES );
|
||||
Dungeon.challenges = bundle.getInt( CHALLENGES );
|
||||
|
||||
Dungeon.level = null;
|
||||
Dungeon.depth = -1;
|
||||
|
@ -544,23 +544,23 @@ public class Dungeon {
|
|||
quickslot.restorePlaceholders( bundle );
|
||||
|
||||
if (fullLoad) {
|
||||
transmutation = bundle.getInt( WT );
|
||||
transmutation = bundle.getInt( WT );
|
||||
|
||||
//TODO: adjust this when dropping support for pre-0.2.3 saves
|
||||
if (bundle.contains( LIMDROPS )) {
|
||||
int[] dropValues = bundle.getIntArray(LIMDROPS);
|
||||
for (limitedDrops value : limitedDrops.values())
|
||||
value.count = value.ordinal() < dropValues.length ?
|
||||
dropValues[value.ordinal()] : 0;
|
||||
} else {
|
||||
for (limitedDrops value : limitedDrops.values())
|
||||
value.count = 0;
|
||||
limitedDrops.strengthPotions.count = bundle.getInt(POS);
|
||||
limitedDrops.upgradeScrolls.count = bundle.getInt(SOU);
|
||||
limitedDrops.arcaneStyli.count = bundle.getInt(AS);
|
||||
}
|
||||
//for pre-0.2.4 saves
|
||||
if (bundle.getBoolean(DV)) limitedDrops.dewVial.drop();
|
||||
//TODO: adjust this when dropping support for pre-0.2.3 saves
|
||||
if (bundle.contains( LIMDROPS )) {
|
||||
int[] dropValues = bundle.getIntArray(LIMDROPS);
|
||||
for (limitedDrops value : limitedDrops.values())
|
||||
value.count = value.ordinal() < dropValues.length ?
|
||||
dropValues[value.ordinal()] : 0;
|
||||
} else {
|
||||
for (limitedDrops value : limitedDrops.values())
|
||||
value.count = 0;
|
||||
limitedDrops.strengthPotions.count = bundle.getInt(POS);
|
||||
limitedDrops.upgradeScrolls.count = bundle.getInt(SOU);
|
||||
limitedDrops.arcaneStyli.count = bundle.getInt(AS);
|
||||
}
|
||||
//for pre-0.2.4 saves
|
||||
if (bundle.getBoolean(DV)) limitedDrops.dewVial.drop();
|
||||
|
||||
chapters = new HashSet<Integer>();
|
||||
int ids[] = bundle.getIntArray( CHAPTERS );
|
||||
|
@ -601,7 +601,7 @@ public class Dungeon {
|
|||
|
||||
Statistics.restoreFromBundle( bundle );
|
||||
Journal.restoreFromBundle( bundle );
|
||||
Generator.restoreFromBundle( bundle );
|
||||
Generator.restoreFromBundle( bundle );
|
||||
|
||||
droppedItems = new SparseArray<ArrayList<Item>>();
|
||||
for (int i=2; i <= Statistics.deepestFloor + 1; i++) {
|
||||
|
@ -678,9 +678,9 @@ public class Dungeon {
|
|||
|
||||
hero.belongings.identify();
|
||||
|
||||
if (challenges != 0) {
|
||||
Badges.validateChampion();
|
||||
}
|
||||
if (challenges != 0) {
|
||||
Badges.validateChampion();
|
||||
}
|
||||
|
||||
resultDescription = desc;
|
||||
Rankings.INSTANCE.submit( true );
|
||||
|
|
|
@ -26,17 +26,17 @@ enum Preferences {
|
|||
INSTANCE;
|
||||
|
||||
public static final String KEY_LANDSCAPE = "landscape";
|
||||
public static final String KEY_IMMERSIVE = "immersive";
|
||||
public static final String KEY_IMMERSIVE = "immersive";
|
||||
public static final String KEY_SCALE_UP = "scaleup";
|
||||
public static final String KEY_MUSIC = "music";
|
||||
public static final String KEY_SOUND_FX = "soundfx";
|
||||
public static final String KEY_ZOOM = "zoom";
|
||||
public static final String KEY_LAST_CLASS = "last_class";
|
||||
public static final String KEY_CHALLENGES = "challenges";
|
||||
public static final String KEY_CHALLENGES = "challenges";
|
||||
public static final String KEY_QUICKSLOTS = "quickslots";
|
||||
public static final String KEY_INTRO = "intro";
|
||||
public static final String KEY_BRIGHTNESS = "brightness";
|
||||
public static final String KEY_VERSION = "version";
|
||||
public static final String KEY_VERSION = "version";
|
||||
|
||||
private SharedPreferences prefs;
|
||||
|
||||
|
|
|
@ -8,123 +8,120 @@ import com.watabou.utils.Random;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Created by debenhame on 16/01/2015.
|
||||
*/
|
||||
public class QuickSlot {
|
||||
|
||||
/**
|
||||
* Slots contain objects which are also in a player's inventory. The one exception to this is when quantity is 0,
|
||||
* which can happen for a stackable item that has been 'used up', these are refered to a placeholders.
|
||||
*/
|
||||
/**
|
||||
* Slots contain objects which are also in a player's inventory. The one exception to this is when quantity is 0,
|
||||
* which can happen for a stackable item that has been 'used up', these are refered to a placeholders.
|
||||
*/
|
||||
|
||||
//note that the current max size is coded at 4, due to UI constraints, but it could be much much bigger with no issue.
|
||||
public static int SIZE = 4;
|
||||
private Item[] slots = new Item[SIZE];
|
||||
//note that the current max size is coded at 4, due to UI constraints, but it could be much much bigger with no issue.
|
||||
public static int SIZE = 4;
|
||||
private Item[] slots = new Item[SIZE];
|
||||
|
||||
|
||||
//direct array interaction methods, everything should build from these methods.
|
||||
public void setSlot(int slot, Item item){
|
||||
clearItem(item); //we don't want to allow the same item in multiple slots.
|
||||
slots[slot] = item;
|
||||
}
|
||||
//direct array interaction methods, everything should build from these methods.
|
||||
public void setSlot(int slot, Item item){
|
||||
clearItem(item); //we don't want to allow the same item in multiple slots.
|
||||
slots[slot] = item;
|
||||
}
|
||||
|
||||
public void clearSlot(int slot){
|
||||
slots[slot] = null;
|
||||
}
|
||||
public void clearSlot(int slot){
|
||||
slots[slot] = null;
|
||||
}
|
||||
|
||||
public void reset(){
|
||||
slots = new Item[SIZE];
|
||||
}
|
||||
public void reset(){
|
||||
slots = new Item[SIZE];
|
||||
}
|
||||
|
||||
public Item getItem(int slot){
|
||||
return slots[slot];
|
||||
}
|
||||
public Item getItem(int slot){
|
||||
return slots[slot];
|
||||
}
|
||||
|
||||
|
||||
//utility methods, for easier use of the internal array.
|
||||
public int getSlot(Item item) {
|
||||
for (int i = 0; i < SIZE; i++)
|
||||
if (getItem(i) == item)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
//utility methods, for easier use of the internal array.
|
||||
public int getSlot(Item item) {
|
||||
for (int i = 0; i < SIZE; i++)
|
||||
if (getItem(i) == item)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
public Boolean isPlaceholder(int slot){
|
||||
return getItem(slot) != null && getItem(slot).quantity() == 0;
|
||||
}
|
||||
public Boolean isPlaceholder(int slot){
|
||||
return getItem(slot) != null && getItem(slot).quantity() == 0;
|
||||
}
|
||||
|
||||
public Boolean isNonePlaceholder(int slot){
|
||||
return getItem(slot) != null && getItem(slot).quantity() > 0;
|
||||
}
|
||||
|
||||
public void clearItem(Item item){
|
||||
if (contains(item))
|
||||
clearSlot(getSlot(item));
|
||||
}
|
||||
public void clearItem(Item item){
|
||||
if (contains(item))
|
||||
clearSlot(getSlot(item));
|
||||
}
|
||||
|
||||
public boolean contains(Item item){
|
||||
return getSlot(item) != -1;
|
||||
}
|
||||
public boolean contains(Item item){
|
||||
return getSlot(item) != -1;
|
||||
}
|
||||
|
||||
public void replaceSimilar(Item item){
|
||||
for (int i = 0; i < SIZE; i++)
|
||||
if (getItem(i) != null && item.isSimilar(getItem(i)))
|
||||
setSlot( i , item );
|
||||
}
|
||||
public void replaceSimilar(Item item){
|
||||
for (int i = 0; i < SIZE; i++)
|
||||
if (getItem(i) != null && item.isSimilar(getItem(i)))
|
||||
setSlot( i , item );
|
||||
}
|
||||
|
||||
public void convertToPlaceholder(Item item){
|
||||
Item placeholder = Item.virtual(item.getClass());
|
||||
public void convertToPlaceholder(Item item){
|
||||
Item placeholder = Item.virtual(item.getClass());
|
||||
|
||||
if (placeholder != null && contains(item))
|
||||
for (int i = 0; i < SIZE; i++)
|
||||
if (getItem(i) == item)
|
||||
setSlot( i , placeholder );
|
||||
}
|
||||
if (placeholder != null && contains(item))
|
||||
for (int i = 0; i < SIZE; i++)
|
||||
if (getItem(i) == item)
|
||||
setSlot( i , placeholder );
|
||||
}
|
||||
|
||||
public Item randomNonePlaceholder(){
|
||||
public Item randomNonePlaceholder(){
|
||||
|
||||
ArrayList<Item> result = new ArrayList<Item>();
|
||||
for (int i = 0; i < SIZE; i ++)
|
||||
if (getItem(i) != null && !isPlaceholder(i))
|
||||
result.add(getItem(i));
|
||||
ArrayList<Item> result = new ArrayList<Item>();
|
||||
for (int i = 0; i < SIZE; i ++)
|
||||
if (getItem(i) != null && !isPlaceholder(i))
|
||||
result.add(getItem(i));
|
||||
|
||||
return Random.element(result);
|
||||
}
|
||||
return Random.element(result);
|
||||
}
|
||||
|
||||
private final String PLACEHOLDERS = "placeholders";
|
||||
private final String PLACEMENTS = "placements";
|
||||
private final String PLACEHOLDERS = "placeholders";
|
||||
private final String PLACEMENTS = "placements";
|
||||
|
||||
/**
|
||||
* Placements array is used as order is preserved while bundling, but exact index is not, so if we
|
||||
* bundle both the placeholders (which preserves their order) and an array telling us where the placeholders are,
|
||||
* we can reconstruct them perfectly.
|
||||
*/
|
||||
/**
|
||||
* Placements array is used as order is preserved while bundling, but exact index is not, so if we
|
||||
* bundle both the placeholders (which preserves their order) and an array telling us where the placeholders are,
|
||||
* we can reconstruct them perfectly.
|
||||
*/
|
||||
|
||||
public void storePlaceholders(Bundle bundle){
|
||||
ArrayList<Item> placeholders = new ArrayList<Item>(SIZE);
|
||||
boolean[] placements = new boolean[SIZE];
|
||||
public void storePlaceholders(Bundle bundle){
|
||||
ArrayList<Item> placeholders = new ArrayList<Item>(SIZE);
|
||||
boolean[] placements = new boolean[SIZE];
|
||||
|
||||
for (int i = 0; i < SIZE; i++)
|
||||
if (isPlaceholder(i)) {
|
||||
placeholders.add(getItem(i));
|
||||
placements[i] = true;
|
||||
}
|
||||
bundle.put( PLACEHOLDERS, placeholders );
|
||||
bundle.put( PLACEMENTS, placements );
|
||||
}
|
||||
for (int i = 0; i < SIZE; i++)
|
||||
if (isPlaceholder(i)) {
|
||||
placeholders.add(getItem(i));
|
||||
placements[i] = true;
|
||||
}
|
||||
bundle.put( PLACEHOLDERS, placeholders );
|
||||
bundle.put( PLACEMENTS, placements );
|
||||
}
|
||||
|
||||
public void restorePlaceholders(Bundle bundle){
|
||||
Collection<Bundlable> placeholders = bundle.getCollection(PLACEHOLDERS);
|
||||
boolean[] placements = bundle.getBooleanArray( PLACEMENTS );
|
||||
public void restorePlaceholders(Bundle bundle){
|
||||
Collection<Bundlable> placeholders = bundle.getCollection(PLACEHOLDERS);
|
||||
boolean[] placements = bundle.getBooleanArray( PLACEMENTS );
|
||||
|
||||
int i = 0;
|
||||
for (Bundlable item : placeholders){
|
||||
while (!placements[i]) i++;
|
||||
setSlot( i, (Item)item );
|
||||
i++;
|
||||
}
|
||||
int i = 0;
|
||||
for (Bundlable item : placeholders){
|
||||
while (!placements[i]) i++;
|
||||
setSlot( i, (Item)item );
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -103,11 +103,11 @@ public class ShatteredPixelDungeon extends Game {
|
|||
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY );
|
||||
}*/
|
||||
|
||||
updateImmersiveMode();
|
||||
updateImmersiveMode();
|
||||
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
instance.getWindowManager().getDefaultDisplay().getMetrics( metrics );
|
||||
boolean landscape = metrics.widthPixels > metrics.heightPixels;
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
instance.getWindowManager().getDefaultDisplay().getMetrics( metrics );
|
||||
boolean landscape = metrics.widthPixels > metrics.heightPixels;
|
||||
|
||||
if (Preferences.INSTANCE.getBoolean( Preferences.KEY_LANDSCAPE, false ) != landscape) {
|
||||
landscape( !landscape );
|
||||
|
@ -121,16 +121,16 @@ public class ShatteredPixelDungeon extends Game {
|
|||
Assets.SND_BADGE,
|
||||
Assets.SND_GOLD,
|
||||
|
||||
Assets.SND_STEP,
|
||||
Assets.SND_WATER,
|
||||
Assets.SND_OPEN,
|
||||
Assets.SND_UNLOCK,
|
||||
Assets.SND_ITEM,
|
||||
Assets.SND_DEWDROP,
|
||||
Assets.SND_HIT,
|
||||
Assets.SND_MISS,
|
||||
Assets.SND_STEP,
|
||||
Assets.SND_WATER,
|
||||
Assets.SND_OPEN,
|
||||
Assets.SND_UNLOCK,
|
||||
Assets.SND_ITEM,
|
||||
Assets.SND_DEWDROP,
|
||||
Assets.SND_HIT,
|
||||
Assets.SND_MISS,
|
||||
|
||||
Assets.SND_DESCEND,
|
||||
Assets.SND_DESCEND,
|
||||
Assets.SND_EAT,
|
||||
Assets.SND_READ,
|
||||
Assets.SND_LULLABY,
|
||||
|
@ -167,20 +167,20 @@ public class ShatteredPixelDungeon extends Game {
|
|||
Assets.SND_MIMIC );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged( boolean hasFocus ) {
|
||||
@Override
|
||||
public void onWindowFocusChanged( boolean hasFocus ) {
|
||||
|
||||
super.onWindowFocusChanged( hasFocus );
|
||||
super.onWindowFocusChanged( hasFocus );
|
||||
|
||||
if (hasFocus) {
|
||||
updateImmersiveMode();
|
||||
}
|
||||
}
|
||||
if (hasFocus) {
|
||||
updateImmersiveMode();
|
||||
}
|
||||
}
|
||||
|
||||
public static void switchNoFade( Class<? extends PixelScene> c ) {
|
||||
PixelScene.noFade = true;
|
||||
switchScene( c );
|
||||
}
|
||||
public static void switchNoFade( Class<? extends PixelScene> c ) {
|
||||
PixelScene.noFade = true;
|
||||
switchScene( c );
|
||||
}
|
||||
|
||||
/*
|
||||
* ---> Prefernces
|
||||
|
@ -202,59 +202,59 @@ public class ShatteredPixelDungeon extends Game {
|
|||
switchScene( TitleScene.class );
|
||||
}
|
||||
|
||||
// *** IMMERSIVE MODE ****
|
||||
// *** IMMERSIVE MODE ****
|
||||
|
||||
private static boolean immersiveModeChanged = false;
|
||||
private static boolean immersiveModeChanged = false;
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public static void immerse( boolean value ) {
|
||||
Preferences.INSTANCE.put( Preferences.KEY_IMMERSIVE, value );
|
||||
@SuppressLint("NewApi")
|
||||
public static void immerse( boolean value ) {
|
||||
Preferences.INSTANCE.put( Preferences.KEY_IMMERSIVE, value );
|
||||
|
||||
instance.runOnUiThread( new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateImmersiveMode();
|
||||
immersiveModeChanged = true;
|
||||
}
|
||||
} );
|
||||
}
|
||||
instance.runOnUiThread( new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateImmersiveMode();
|
||||
immersiveModeChanged = true;
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSurfaceChanged( GL10 gl, int width, int height ) {
|
||||
super.onSurfaceChanged( gl, width, height );
|
||||
@Override
|
||||
public void onSurfaceChanged( GL10 gl, int width, int height ) {
|
||||
super.onSurfaceChanged( gl, width, height );
|
||||
|
||||
if (immersiveModeChanged) {
|
||||
requestedReset = true;
|
||||
immersiveModeChanged = false;
|
||||
}
|
||||
}
|
||||
if (immersiveModeChanged) {
|
||||
requestedReset = true;
|
||||
immersiveModeChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public static void updateImmersiveMode() {
|
||||
if (android.os.Build.VERSION.SDK_INT >= 19) {
|
||||
try {
|
||||
// Sometime NullPointerException happens here
|
||||
instance.getWindow().getDecorView().setSystemUiVisibility(
|
||||
immersed() ?
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
||||
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_FULLSCREEN |
|
||||
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||
:
|
||||
0 );
|
||||
} catch (Exception e) {
|
||||
reportException( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
@SuppressLint("NewApi")
|
||||
public static void updateImmersiveMode() {
|
||||
if (android.os.Build.VERSION.SDK_INT >= 19) {
|
||||
try {
|
||||
// Sometime NullPointerException happens here
|
||||
instance.getWindow().getDecorView().setSystemUiVisibility(
|
||||
immersed() ?
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
||||
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_FULLSCREEN |
|
||||
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||
:
|
||||
0 );
|
||||
} catch (Exception e) {
|
||||
reportException( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean immersed() {
|
||||
return Preferences.INSTANCE.getBoolean( Preferences.KEY_IMMERSIVE, false );
|
||||
}
|
||||
public static boolean immersed() {
|
||||
return Preferences.INSTANCE.getBoolean( Preferences.KEY_IMMERSIVE, false );
|
||||
}
|
||||
|
||||
// *****************************
|
||||
// *****************************
|
||||
|
||||
public static boolean scaleUp() {
|
||||
return Preferences.INSTANCE.getBoolean( Preferences.KEY_SCALE_UP, true );
|
||||
|
@ -305,13 +305,13 @@ public class ShatteredPixelDungeon extends Game {
|
|||
return Preferences.INSTANCE.getInt( Preferences.KEY_LAST_CLASS, 0 );
|
||||
}
|
||||
|
||||
public static void challenges( int value ) {
|
||||
Preferences.INSTANCE.put( Preferences.KEY_CHALLENGES, value );
|
||||
}
|
||||
public static void challenges( int value ) {
|
||||
Preferences.INSTANCE.put( Preferences.KEY_CHALLENGES, value );
|
||||
}
|
||||
|
||||
public static int challenges() {
|
||||
return Preferences.INSTANCE.getInt( Preferences.KEY_CHALLENGES, 0 );
|
||||
}
|
||||
public static int challenges() {
|
||||
return Preferences.INSTANCE.getInt( Preferences.KEY_CHALLENGES, 0 );
|
||||
}
|
||||
|
||||
public static void quickSlots( int value ){ Preferences.INSTANCE.put( Preferences.KEY_QUICKSLOTS, value ); }
|
||||
|
||||
|
@ -325,13 +325,13 @@ public class ShatteredPixelDungeon extends Game {
|
|||
return Preferences.INSTANCE.getBoolean( Preferences.KEY_INTRO, true );
|
||||
}
|
||||
|
||||
public static void version( int value) {
|
||||
Preferences.INSTANCE.put( Preferences.KEY_VERSION, value );
|
||||
}
|
||||
public static void version( int value) {
|
||||
Preferences.INSTANCE.put( Preferences.KEY_VERSION, value );
|
||||
}
|
||||
|
||||
public static int version() {
|
||||
return Preferences.INSTANCE.getInt( Preferences.KEY_VERSION, 0 );
|
||||
}
|
||||
public static int version() {
|
||||
return Preferences.INSTANCE.getInt( Preferences.KEY_VERSION, 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
* <--- Preferences
|
||||
|
|
|
@ -83,7 +83,7 @@ public abstract class Actor implements Bundlable {
|
|||
id = bundle.getInt( ID );
|
||||
}
|
||||
|
||||
private static int nextID = 1;
|
||||
private static int nextID = 1;
|
||||
public int id() {
|
||||
if (id > 0) {
|
||||
return id;
|
||||
|
@ -144,25 +144,25 @@ public abstract class Actor implements Bundlable {
|
|||
current = null;
|
||||
}
|
||||
|
||||
private static final String NEXTID = "nextid";
|
||||
private static final String NEXTID = "nextid";
|
||||
|
||||
public static void storeNextID( Bundle bundle){
|
||||
bundle.put( NEXTID, nextID );
|
||||
}
|
||||
public static void storeNextID( Bundle bundle){
|
||||
bundle.put( NEXTID, nextID );
|
||||
}
|
||||
|
||||
public static void restoreNextID( Bundle bundle){
|
||||
nextID = bundle.getInt( NEXTID );
|
||||
}
|
||||
public static void restoreNextID( Bundle bundle){
|
||||
nextID = bundle.getInt( NEXTID );
|
||||
}
|
||||
|
||||
public static void resetNextID(){
|
||||
nextID = 1;
|
||||
}
|
||||
public static void resetNextID(){
|
||||
nextID = 1;
|
||||
}
|
||||
|
||||
/*protected*/public void next() {
|
||||
if (current == this) {
|
||||
current = null;
|
||||
}
|
||||
}
|
||||
/*protected*/public void next() {
|
||||
if (current == this) {
|
||||
current = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void process() {
|
||||
|
||||
|
@ -190,12 +190,12 @@ public abstract class Actor implements Bundlable {
|
|||
|
||||
if (current != null) {
|
||||
|
||||
if (current instanceof Char && ((Char)current).sprite.isMoving) {
|
||||
// If it's character's turn to act, but its sprite
|
||||
// is moving, wait till the movement is over
|
||||
current = null;
|
||||
break;
|
||||
}
|
||||
if (current instanceof Char && ((Char)current).sprite.isMoving) {
|
||||
// If it's character's turn to act, but its sprite
|
||||
// is moving, wait till the movement is over
|
||||
current = null;
|
||||
break;
|
||||
}
|
||||
|
||||
doNext = current.act();
|
||||
if (doNext && !Dungeon.hero.isAlive()) {
|
||||
|
|
|
@ -121,7 +121,7 @@ public abstract class Char extends Actor {
|
|||
|
||||
// FIXME
|
||||
int dr = this instanceof Hero && ((Hero)this).rangedWeapon != null && ((Hero)this).subClass ==
|
||||
HeroSubClass.SNIPER ? 0 : Random.IntRange( 0, enemy.dr() );
|
||||
HeroSubClass.SNIPER ? 0 : Random.IntRange( 0, enemy.dr() );
|
||||
|
||||
int dmg = damageRoll();
|
||||
int effectiveDamage = Math.max( dmg - dr, 0 );
|
||||
|
@ -242,11 +242,11 @@ public abstract class Char extends Actor {
|
|||
return;
|
||||
}
|
||||
if (this.buff(Frost.class) != null){
|
||||
Buff.detach( this, Frost.class );
|
||||
}
|
||||
if (this.buff(MagicalSleep.class) != null){
|
||||
Buff.detach(this, MagicalSleep.class);
|
||||
}
|
||||
Buff.detach( this, Frost.class );
|
||||
}
|
||||
if (this.buff(MagicalSleep.class) != null){
|
||||
Buff.detach(this, MagicalSleep.class);
|
||||
}
|
||||
|
||||
Class<?> srcClass = src.getClass();
|
||||
if (immunities().contains( srcClass )) {
|
||||
|
|
|
@ -26,28 +26,28 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
|||
|
||||
public class ConfusionGas extends Blob {
|
||||
|
||||
@Override
|
||||
protected void evolve() {
|
||||
super.evolve();
|
||||
@Override
|
||||
protected void evolve() {
|
||||
super.evolve();
|
||||
|
||||
Char ch;
|
||||
for (int i=0; i < LENGTH; i++) {
|
||||
if (cur[i] > 0 && (ch = Actor.findChar( i )) != null) {
|
||||
if (!ch.immunities().contains(this.getClass()))
|
||||
Buff.prolong( ch, Vertigo.class, 2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
Char ch;
|
||||
for (int i=0; i < LENGTH; i++) {
|
||||
if (cur[i] > 0 && (ch = Actor.findChar( i )) != null) {
|
||||
if (!ch.immunities().contains(this.getClass()))
|
||||
Buff.prolong( ch, Vertigo.class, 2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void use( BlobEmitter emitter ) {
|
||||
super.use( emitter );
|
||||
@Override
|
||||
public void use( BlobEmitter emitter ) {
|
||||
super.use( emitter );
|
||||
|
||||
emitter.pour( Speck.factory( Speck.CONFUSION, true ), 0.6f );
|
||||
}
|
||||
emitter.pour( Speck.factory( Speck.CONFUSION, true ), 0.6f );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String tileDesc() {
|
||||
return "A cloud of confusion gas is swirling here.";
|
||||
}
|
||||
@Override
|
||||
public String tileDesc() {
|
||||
return "A cloud of confusion gas is swirling here.";
|
||||
}
|
||||
}
|
|
@ -35,11 +35,11 @@ public class Freezing {
|
|||
|
||||
Char ch = Actor.findChar( cell );
|
||||
if (ch != null) {
|
||||
if (Level.water[ch.pos]){
|
||||
Buff.prolong(ch, Frost.class, Frost.duration(ch) * Random.Float(5f, 7.5f));
|
||||
} else {
|
||||
Buff.prolong(ch, Frost.class, Frost.duration(ch) * Random.Float(1.0f, 1.5f));
|
||||
}
|
||||
if (Level.water[ch.pos]){
|
||||
Buff.prolong(ch, Frost.class, Frost.duration(ch) * Random.Float(5f, 7.5f));
|
||||
} else {
|
||||
Buff.prolong(ch, Frost.class, Frost.duration(ch) * Random.Float(1.0f, 1.5f));
|
||||
}
|
||||
}
|
||||
|
||||
if (fire != null) {
|
||||
|
|
|
@ -5,52 +5,49 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.blobs;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.GooSprite;
|
||||
|
||||
/**
|
||||
* Created by Evan on 29/09/2014.
|
||||
*/
|
||||
public class GooWarn extends Blob {
|
||||
|
||||
//cosmetic blob, used to warn noobs that goo's pump up should, infact, be avoided.
|
||||
//cosmetic blob, used to warn noobs that goo's pump up should, infact, be avoided.
|
||||
|
||||
{
|
||||
//this one needs to act after the Goo
|
||||
actPriority = 3;
|
||||
}
|
||||
{
|
||||
//this one needs to act after the Goo
|
||||
actPriority = 3;
|
||||
}
|
||||
|
||||
protected int pos;
|
||||
protected int pos;
|
||||
|
||||
@Override
|
||||
protected void evolve() {
|
||||
for (int i=0; i < LENGTH; i++) {
|
||||
@Override
|
||||
protected void evolve() {
|
||||
for (int i=0; i < LENGTH; i++) {
|
||||
|
||||
int offv = cur[i] > 0 ? cur[i] - 1 : 0;
|
||||
off[i] = offv;
|
||||
int offv = cur[i] > 0 ? cur[i] - 1 : 0;
|
||||
off[i] = offv;
|
||||
|
||||
if (offv > 0) {
|
||||
volume += offv;
|
||||
}
|
||||
}
|
||||
if (offv > 0) {
|
||||
volume += offv;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void seed( int cell, int amount ) {
|
||||
int diff = amount - cur[cell];
|
||||
if (diff > 0) {
|
||||
cur[cell] = amount;
|
||||
volume += diff;
|
||||
}
|
||||
}
|
||||
public void seed( int cell, int amount ) {
|
||||
int diff = amount - cur[cell];
|
||||
if (diff > 0) {
|
||||
cur[cell] = amount;
|
||||
volume += diff;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void use( BlobEmitter emitter ) {
|
||||
super.use( emitter );
|
||||
emitter.pour(GooSprite.GooParticle.FACTORY, 0.03f );
|
||||
}
|
||||
@Override
|
||||
public void use( BlobEmitter emitter ) {
|
||||
super.use( emitter );
|
||||
emitter.pour(GooSprite.GooParticle.FACTORY, 0.03f );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String tileDesc() {
|
||||
return "Specs of dark energy are swarming here!";
|
||||
}
|
||||
@Override
|
||||
public String tileDesc() {
|
||||
return "Specs of dark energy are swarming here!";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ public class ParalyticGas extends Blob {
|
|||
Char ch;
|
||||
for (int i=0; i < LENGTH; i++) {
|
||||
if (cur[i] > 0 && (ch = Actor.findChar( i )) != null) {
|
||||
if (!ch.immunities().contains(this.getClass()))
|
||||
Buff.prolong( ch, Paralysis.class, Paralysis.duration( ch ) );
|
||||
if (!ch.immunities().contains(this.getClass()))
|
||||
Buff.prolong( ch, Paralysis.class, Paralysis.duration( ch ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,33 +7,30 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
|
||||
/**
|
||||
* Created by debenhame on 08/10/2014.
|
||||
*/
|
||||
public class StenchGas extends Blob {
|
||||
|
||||
@Override
|
||||
protected void evolve() {
|
||||
super.evolve();
|
||||
@Override
|
||||
protected void evolve() {
|
||||
super.evolve();
|
||||
|
||||
Char ch;
|
||||
for (int i=0; i < LENGTH; i++) {
|
||||
if (cur[i] > 0 && (ch = Actor.findChar(i)) != null) {
|
||||
if (!ch.immunities().contains(this.getClass()))
|
||||
Buff.prolong( ch, Paralysis.class, Paralysis.duration( ch )/5 );
|
||||
}
|
||||
}
|
||||
}
|
||||
Char ch;
|
||||
for (int i=0; i < LENGTH; i++) {
|
||||
if (cur[i] > 0 && (ch = Actor.findChar(i)) != null) {
|
||||
if (!ch.immunities().contains(this.getClass()))
|
||||
Buff.prolong( ch, Paralysis.class, Paralysis.duration( ch )/5 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void use( BlobEmitter emitter ) {
|
||||
super.use( emitter );
|
||||
@Override
|
||||
public void use( BlobEmitter emitter ) {
|
||||
super.use( emitter );
|
||||
|
||||
emitter.pour( Speck.factory(Speck.STENCH), 0.6f );
|
||||
}
|
||||
emitter.pour( Speck.factory(Speck.STENCH), 0.6f );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String tileDesc() {
|
||||
return "A cloud of fetid stench is swirling here.";
|
||||
}
|
||||
@Override
|
||||
public String tileDesc() {
|
||||
return "A cloud of fetid stench is swirling here.";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,20 +31,20 @@ import com.watabou.utils.Random;
|
|||
|
||||
public class ToxicGas extends Blob implements Hero.Doom {
|
||||
|
||||
@Override
|
||||
protected void evolve() {
|
||||
super.evolve();
|
||||
@Override
|
||||
protected void evolve() {
|
||||
super.evolve();
|
||||
|
||||
int levelDamage = 5 + Dungeon.depth * 5;
|
||||
int levelDamage = 5 + Dungeon.depth * 5;
|
||||
|
||||
Char ch;
|
||||
for (int i=0; i < LENGTH; i++) {
|
||||
if (cur[i] > 0 && (ch = Actor.findChar( i )) != null) {
|
||||
Char ch;
|
||||
for (int i=0; i < LENGTH; i++) {
|
||||
if (cur[i] > 0 && (ch = Actor.findChar( i )) != null) {
|
||||
|
||||
int damage = (ch.HT + levelDamage) / 40;
|
||||
if (Random.Int( 40 ) < (ch.HT + levelDamage) % 40) {
|
||||
damage++;
|
||||
}
|
||||
int damage = (ch.HT + levelDamage) / 40;
|
||||
if (Random.Int( 40 ) < (ch.HT + levelDamage) % 40) {
|
||||
damage++;
|
||||
}
|
||||
|
||||
ch.damage( damage, this );
|
||||
}
|
||||
|
|
|
@ -8,58 +8,55 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.watabou.utils.Bundle;
|
||||
|
||||
/**
|
||||
* Created by Evan on 12/04/2015.
|
||||
*/
|
||||
public class VenomGas extends Blob {
|
||||
|
||||
private int strength = 0;
|
||||
private int strength = 0;
|
||||
|
||||
@Override
|
||||
protected void evolve() {
|
||||
super.evolve();
|
||||
@Override
|
||||
protected void evolve() {
|
||||
super.evolve();
|
||||
|
||||
if (volume == 0){
|
||||
strength = 0;
|
||||
} else {
|
||||
Char ch;
|
||||
for (int i = 0; i < LENGTH; i++) {
|
||||
if (cur[i] > 0 && (ch = Actor.findChar(i)) != null) {
|
||||
if (!ch.immunities().contains(this.getClass()))
|
||||
Buff.affect(ch, Venom.class).set(2f, strength);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (volume == 0){
|
||||
strength = 0;
|
||||
} else {
|
||||
Char ch;
|
||||
for (int i = 0; i < LENGTH; i++) {
|
||||
if (cur[i] > 0 && (ch = Actor.findChar(i)) != null) {
|
||||
if (!ch.immunities().contains(this.getClass()))
|
||||
Buff.affect(ch, Venom.class).set(2f, strength);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setStrength(int str){
|
||||
if (str > strength)
|
||||
strength = str;
|
||||
}
|
||||
public void setStrength(int str){
|
||||
if (str > strength)
|
||||
strength = str;
|
||||
}
|
||||
|
||||
private static final String STRENGTH = "strength";
|
||||
private static final String STRENGTH = "strength";
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle(Bundle bundle) {
|
||||
super.restoreFromBundle(bundle);
|
||||
strength = bundle.getInt( STRENGTH );
|
||||
}
|
||||
@Override
|
||||
public void restoreFromBundle(Bundle bundle) {
|
||||
super.restoreFromBundle(bundle);
|
||||
strength = bundle.getInt( STRENGTH );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeInBundle(Bundle bundle) {
|
||||
super.storeInBundle(bundle);
|
||||
bundle.put( STRENGTH, strength );
|
||||
}
|
||||
@Override
|
||||
public void storeInBundle(Bundle bundle) {
|
||||
super.storeInBundle(bundle);
|
||||
bundle.put( STRENGTH, strength );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void use( BlobEmitter emitter ) {
|
||||
super.use( emitter );
|
||||
@Override
|
||||
public void use( BlobEmitter emitter ) {
|
||||
super.use( emitter );
|
||||
|
||||
emitter.pour( Speck.factory(Speck.VENOM), 0.6f );
|
||||
}
|
||||
emitter.pour( Speck.factory(Speck.VENOM), 0.6f );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String tileDesc() {
|
||||
return "A could of foul acidic venom is swirling here.";
|
||||
}
|
||||
@Override
|
||||
public String tileDesc() {
|
||||
return "A could of foul acidic venom is swirling here.";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class WaterOfTransmutation extends WellWater {
|
|||
item = changeSeed( (Plant.Seed)item );
|
||||
} else if (item instanceof Artifact) {
|
||||
item = changeArtifact( (Artifact)item );
|
||||
} else {
|
||||
} else {
|
||||
item = null;
|
||||
}
|
||||
|
||||
|
@ -149,18 +149,18 @@ public class WaterOfTransmutation extends WellWater {
|
|||
return n;
|
||||
}
|
||||
|
||||
private Artifact changeArtifact( Artifact a ) {
|
||||
Artifact n = Generator.randomArtifact();
|
||||
private Artifact changeArtifact( Artifact a ) {
|
||||
Artifact n = Generator.randomArtifact();
|
||||
|
||||
if (n != null){
|
||||
n.cursedKnown = a.cursedKnown;
|
||||
n.cursed = a.cursed;
|
||||
n.levelKnown = a.levelKnown;
|
||||
if (n != null){
|
||||
n.cursedKnown = a.cursedKnown;
|
||||
n.cursed = a.cursed;
|
||||
n.levelKnown = a.levelKnown;
|
||||
n.transferUpgrade(a.visiblyUpgraded());
|
||||
}
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
private Wand changeWand( Wand w ) {
|
||||
|
||||
|
|
|
@ -31,14 +31,14 @@ public class Amok extends FlavourBuff {
|
|||
return BuffIndicator.AMOK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach() {
|
||||
super.detach();
|
||||
if (target instanceof Mob)
|
||||
((Mob)target).aggro( null );
|
||||
}
|
||||
@Override
|
||||
public void detach() {
|
||||
super.detach();
|
||||
if (target instanceof Mob)
|
||||
((Mob)target).aggro( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Amok";
|
||||
}
|
||||
|
|
|
@ -3,9 +3,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
/**
|
||||
* Created by debenhame on 27/04/2015.
|
||||
*/
|
||||
public class Bless extends FlavourBuff {
|
||||
|
||||
{
|
||||
|
|
|
@ -37,9 +37,9 @@ public class Buff extends Actor {
|
|||
public enum buffType {POSITIVE, NEGATIVE, NEUTRAL, SILENT};
|
||||
public buffType type = buffType.SILENT;
|
||||
|
||||
public HashSet<Class<?>> resistances = new HashSet<Class<?>>();
|
||||
public HashSet<Class<?>> resistances = new HashSet<Class<?>>();
|
||||
|
||||
public HashSet<Class<?>> immunities = new HashSet<Class<?>>();
|
||||
public HashSet<Class<?>> immunities = new HashSet<Class<?>>();
|
||||
|
||||
public boolean attachTo( Char target ) {
|
||||
|
||||
|
@ -50,11 +50,11 @@ public class Buff extends Actor {
|
|||
this.target = target;
|
||||
target.add( this );
|
||||
|
||||
if (target.buffs().contains(this)){
|
||||
if (target.buffs().contains(this)){
|
||||
if (target.sprite != null) fx( true );
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void detach() {
|
||||
|
|
|
@ -15,9 +15,6 @@ import com.watabou.utils.Random;
|
|||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
/**
|
||||
* Created by debenhame on 23/04/2015.
|
||||
*/
|
||||
public class Chill extends FlavourBuff {
|
||||
|
||||
private static final String TXT_FREEZES = "%s freezes!";
|
||||
|
|
|
@ -3,9 +3,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
/**
|
||||
* Created by Evan on 14/05/2015.
|
||||
*/
|
||||
public class Corruption extends Buff {
|
||||
|
||||
{
|
||||
|
|
|
@ -23,43 +23,43 @@ import com.watabou.utils.Random;
|
|||
|
||||
public class Drowsy extends Buff {
|
||||
|
||||
{
|
||||
type = buffType.NEUTRAL;
|
||||
}
|
||||
{
|
||||
type = buffType.NEUTRAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.DROWSY;
|
||||
}
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.DROWSY;
|
||||
}
|
||||
|
||||
public boolean attachTo( Char target ) {
|
||||
if (!target.immunities().contains(Sleep.class) && super.attachTo(target)) {
|
||||
if (cooldown() == 0)
|
||||
spend(Random.Int(3, 6));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public boolean attachTo( Char target ) {
|
||||
if (!target.immunities().contains(Sleep.class) && super.attachTo(target)) {
|
||||
if (cooldown() == 0)
|
||||
spend(Random.Int(3, 6));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean act(){
|
||||
Buff.affect(target, MagicalSleep.class);
|
||||
@Override
|
||||
public boolean act(){
|
||||
Buff.affect(target, MagicalSleep.class);
|
||||
|
||||
detach();
|
||||
return true;
|
||||
}
|
||||
detach();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Drowsy";
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Drowsy";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "A magical force is making it difficult to stay awake.\n" +
|
||||
"\n" +
|
||||
"The hero can resist drowsiness by taking damage or by being at full health.\n" +
|
||||
"\n" +
|
||||
"After " + dispTurns(cooldown()+1) + ", the target will fall into a deep magical sleep.";
|
||||
}
|
||||
@Override
|
||||
public String desc() {
|
||||
return "A magical force is making it difficult to stay awake.\n" +
|
||||
"\n" +
|
||||
"The hero can resist drowsiness by taking damage or by being at full health.\n" +
|
||||
"\n" +
|
||||
"After " + dispTurns(cooldown()+1) + ", the target will fall into a deep magical sleep.";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,40 +8,37 @@ import com.watabou.utils.Bundle;
|
|||
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* Created by debenhame on 19/11/2014.
|
||||
*/
|
||||
public class EarthImbue extends FlavourBuff {
|
||||
|
||||
public static final float DURATION = 30f;
|
||||
public static final float DURATION = 30f;
|
||||
|
||||
public void proc(Char enemy){
|
||||
Buff.affect(enemy, Roots.class, 2);
|
||||
CellEmitter.bottom(enemy.pos).start(EarthParticle.FACTORY, 0.05f, 8);
|
||||
}
|
||||
public void proc(Char enemy){
|
||||
Buff.affect(enemy, Roots.class, 2);
|
||||
CellEmitter.bottom(enemy.pos).start(EarthParticle.FACTORY, 0.05f, 8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.ROOTS;
|
||||
}
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.ROOTS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Imbued with Earth";
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Imbued with Earth";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "You are inbued with the power of earth!\n" +
|
||||
"\n" +
|
||||
"All physical attacks will command roots to lock the enemy in place while the effect lasts.\n" +
|
||||
"\n" +
|
||||
"You are imbued for " + dispTurns() + ".";
|
||||
}
|
||||
@Override
|
||||
public String desc() {
|
||||
return "You are inbued with the power of earth!\n" +
|
||||
"\n" +
|
||||
"All physical attacks will command roots to lock the enemy in place while the effect lasts.\n" +
|
||||
"\n" +
|
||||
"You are imbued for " + dispTurns() + ".";
|
||||
}
|
||||
|
||||
{
|
||||
immunities.add( Paralysis.class );
|
||||
immunities.add( Roots.class );
|
||||
immunities.add( Slow.class );
|
||||
}
|
||||
{
|
||||
immunities.add( Paralysis.class );
|
||||
immunities.add( Roots.class );
|
||||
immunities.add( Slow.class );
|
||||
}
|
||||
}
|
|
@ -11,77 +11,74 @@ import com.watabou.utils.Random;
|
|||
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* Created by debenhame on 19/11/2014.
|
||||
*/
|
||||
public class FireImbue extends Buff {
|
||||
|
||||
public static final float DURATION = 30f;
|
||||
public static final float DURATION = 30f;
|
||||
|
||||
protected float left;
|
||||
protected float left;
|
||||
|
||||
private static final String LEFT = "left";
|
||||
private static final String LEFT = "left";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( LEFT, left );
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( LEFT, left );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
left = bundle.getFloat( LEFT );
|
||||
}
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
left = bundle.getFloat( LEFT );
|
||||
}
|
||||
|
||||
public void set( float duration ) {
|
||||
this.left = duration;
|
||||
};
|
||||
public void set( float duration ) {
|
||||
this.left = duration;
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (Dungeon.level.map[target.pos] == Terrain.GRASS) {
|
||||
Dungeon.level.set(target.pos, Terrain.EMBERS);
|
||||
GameScene.updateMap(target.pos);
|
||||
}
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (Dungeon.level.map[target.pos] == Terrain.GRASS) {
|
||||
Dungeon.level.set(target.pos, Terrain.EMBERS);
|
||||
GameScene.updateMap(target.pos);
|
||||
}
|
||||
|
||||
spend(TICK);
|
||||
left -= TICK;
|
||||
if (left <= 0)
|
||||
detach();
|
||||
spend(TICK);
|
||||
left -= TICK;
|
||||
if (left <= 0)
|
||||
detach();
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void proc(Char enemy){
|
||||
if (Random.Int(2) == 0)
|
||||
Buff.affect( enemy, Burning.class ).reignite( enemy );
|
||||
public void proc(Char enemy){
|
||||
if (Random.Int(2) == 0)
|
||||
Buff.affect( enemy, Burning.class ).reignite( enemy );
|
||||
|
||||
enemy.sprite.emitter().burst( FlameParticle.FACTORY, 2 );
|
||||
}
|
||||
enemy.sprite.emitter().burst( FlameParticle.FACTORY, 2 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.FIRE;
|
||||
}
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.FIRE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Imbued with Fire";
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Imbued with Fire";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "You are imbued with the power of fire!\n" +
|
||||
"\n" +
|
||||
"All physical attacks will have a chance to light enemies ablaze. " +
|
||||
"Additionally, you are completely immune to the effects of fire.\n" +
|
||||
"\n" +
|
||||
"You are imbued for " + dispTurns(left) + ".";
|
||||
}
|
||||
@Override
|
||||
public String desc() {
|
||||
return "You are imbued with the power of fire!\n" +
|
||||
"\n" +
|
||||
"All physical attacks will have a chance to light enemies ablaze. " +
|
||||
"Additionally, you are completely immune to the effects of fire.\n" +
|
||||
"\n" +
|
||||
"You are imbued for " + dispTurns(left) + ".";
|
||||
}
|
||||
|
||||
{
|
||||
immunities.add( Burning.class );
|
||||
}
|
||||
{
|
||||
immunities.add( Burning.class );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,10 +39,10 @@ public class GasesImmunity extends FlavourBuff {
|
|||
}
|
||||
|
||||
{
|
||||
immunities.add( ParalyticGas.class );
|
||||
immunities.add( ToxicGas.class );
|
||||
immunities.add( ConfusionGas.class );
|
||||
immunities.add( StenchGas.class );
|
||||
immunities.add( ParalyticGas.class );
|
||||
immunities.add( ToxicGas.class );
|
||||
immunities.add( ConfusionGas.class );
|
||||
immunities.add( StenchGas.class );
|
||||
immunities.add( VenomGas.class );
|
||||
}
|
||||
|
||||
|
|
|
@ -44,8 +44,8 @@ public class Invisibility extends FlavourBuff {
|
|||
|
||||
@Override
|
||||
public void detach() {
|
||||
if (target.invisible > 0)
|
||||
target.invisible--;
|
||||
if (target.invisible > 0)
|
||||
target.invisible--;
|
||||
super.detach();
|
||||
}
|
||||
|
||||
|
@ -80,15 +80,15 @@ public class Invisibility extends FlavourBuff {
|
|||
if (buff != null) {
|
||||
buff.detach();
|
||||
}
|
||||
CloakOfShadows.cloakStealth cloakBuff = Dungeon.hero.buff( CloakOfShadows.cloakStealth.class );
|
||||
if (cloakBuff != null) {
|
||||
cloakBuff.act();
|
||||
cloakBuff.detach();
|
||||
}
|
||||
//this isn't a form of invisibilty, but it is meant to dispel at the same time as it.
|
||||
TimekeepersHourglass.timeFreeze timeFreeze = Dungeon.hero.buff( TimekeepersHourglass.timeFreeze.class );
|
||||
if (timeFreeze != null) {
|
||||
timeFreeze.detach();
|
||||
}
|
||||
CloakOfShadows.cloakStealth cloakBuff = Dungeon.hero.buff( CloakOfShadows.cloakStealth.class );
|
||||
if (cloakBuff != null) {
|
||||
cloakBuff.act();
|
||||
cloakBuff.detach();
|
||||
}
|
||||
//this isn't a form of invisibilty, but it is meant to dispel at the same time as it.
|
||||
TimekeepersHourglass.timeFreeze timeFreeze = Dungeon.hero.buff( TimekeepersHourglass.timeFreeze.class );
|
||||
if (timeFreeze != null) {
|
||||
timeFreeze.detach();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
/**
|
||||
* Created by Evan on 04/04/2015.
|
||||
*/
|
||||
public class LockedFloor extends Buff {
|
||||
//this buff is purely meant as a visual indicator that the gameplay implications of a level seal are in effect.
|
||||
|
||||
|
|
|
@ -25,70 +25,70 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
|||
|
||||
public class MagicalSleep extends Buff {
|
||||
|
||||
private static final float STEP = 1f;
|
||||
public static final float SWS = 1.5f;
|
||||
private static final float STEP = 1f;
|
||||
public static final float SWS = 1.5f;
|
||||
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
if (super.attachTo( target ) && !target.immunities().contains(Sleep.class)) {
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
if (super.attachTo( target ) && !target.immunities().contains(Sleep.class)) {
|
||||
|
||||
if (target instanceof Hero)
|
||||
if (target.HP == target.HT) {
|
||||
GLog.i("You are too healthy, and resist the urge to sleep.");
|
||||
detach();
|
||||
return true;
|
||||
} else {
|
||||
GLog.i("You fall into a deep magical sleep.");
|
||||
}
|
||||
else if (target instanceof Mob)
|
||||
((Mob)target).state = ((Mob)target).SLEEPING;
|
||||
if (target instanceof Hero)
|
||||
if (target.HP == target.HT) {
|
||||
GLog.i("You are too healthy, and resist the urge to sleep.");
|
||||
detach();
|
||||
return true;
|
||||
} else {
|
||||
GLog.i("You fall into a deep magical sleep.");
|
||||
}
|
||||
else if (target instanceof Mob)
|
||||
((Mob)target).state = ((Mob)target).SLEEPING;
|
||||
|
||||
target.paralysed = true;
|
||||
target.paralysed = true;
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean act(){
|
||||
if (target instanceof Hero) {
|
||||
target.HP = Math.min(target.HP+1, target.HT);
|
||||
((Hero) target).restoreHealth = true;
|
||||
if (target.HP == target.HT) {
|
||||
GLog.p("You wake up feeling refreshed and healthy.");
|
||||
detach();
|
||||
}
|
||||
}
|
||||
spend( STEP );
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean act(){
|
||||
if (target instanceof Hero) {
|
||||
target.HP = Math.min(target.HP+1, target.HT);
|
||||
((Hero) target).restoreHealth = true;
|
||||
if (target.HP == target.HT) {
|
||||
GLog.p("You wake up feeling refreshed and healthy.");
|
||||
detach();
|
||||
}
|
||||
}
|
||||
spend( STEP );
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach() {
|
||||
target.paralysed = false;
|
||||
if (target instanceof Hero)
|
||||
((Hero) target).restoreHealth = false;
|
||||
super.detach();
|
||||
}
|
||||
@Override
|
||||
public void detach() {
|
||||
target.paralysed = false;
|
||||
if (target instanceof Hero)
|
||||
((Hero) target).restoreHealth = false;
|
||||
super.detach();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.MAGIC_SLEEP;
|
||||
}
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.MAGIC_SLEEP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Magical Sleep";
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Magical Sleep";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "This character has fallen into a deep magical sleep which they will not wake from naturally.\n" +
|
||||
"\n" +
|
||||
"Magical sleep is similar to regular sleep, except that only damage will cause the target to wake up. \n" +
|
||||
"\n" +
|
||||
"For the hero, magical sleep has some restorative properties, allowing them to rapidly heal while resting.";
|
||||
}
|
||||
@Override
|
||||
public String desc() {
|
||||
return "This character has fallen into a deep magical sleep which they will not wake from naturally.\n" +
|
||||
"\n" +
|
||||
"Magical sleep is similar to regular sleep, except that only damage will cause the target to wake up. \n" +
|
||||
"\n" +
|
||||
"For the hero, magical sleep has some restorative properties, allowing them to rapidly heal while resting.";
|
||||
}
|
||||
}
|
|
@ -55,10 +55,10 @@ public class Ooze extends Buff {
|
|||
@Override
|
||||
public boolean act() {
|
||||
if (target.isAlive()) {
|
||||
if (Dungeon.depth > 4)
|
||||
target.damage( Dungeon.depth/5, this );
|
||||
else if (Random.Int(2) == 0)
|
||||
target.damage( 1, this );
|
||||
if (Dungeon.depth > 4)
|
||||
target.damage( Dungeon.depth/5, this );
|
||||
else if (Random.Int(2) == 0)
|
||||
target.damage( 1, this );
|
||||
if (!target.isAlive() && target == Dungeon.hero) {
|
||||
Dungeon.fail( ResultDescriptions.OOZE );
|
||||
GLog.n( TXT_HERO_KILLED, toString() );
|
||||
|
|
|
@ -9,9 +9,6 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
|
||||
/**
|
||||
* Created by debenhame on 06/02/2015.
|
||||
*/
|
||||
public class PinCushion extends Buff {
|
||||
|
||||
private ArrayList<MissileWeapon> items = new ArrayList<MissileWeapon>();
|
||||
|
|
|
@ -31,7 +31,7 @@ public class Regeneration extends Buff {
|
|||
|
||||
|
||||
|
||||
if (target.HP < target.HT && !((Hero)target).isStarving()) {
|
||||
if (target.HP < target.HT && !((Hero)target).isStarving()) {
|
||||
target.HP += 1;
|
||||
}
|
||||
|
||||
|
@ -42,8 +42,8 @@ public class Regeneration extends Buff {
|
|||
spend( REGENERATION_DELAY * 1.5f );
|
||||
else
|
||||
spend( REGENERATION_DELAY - regenBuff.level()*0.9f );
|
||||
else
|
||||
spend( REGENERATION_DELAY );
|
||||
else
|
||||
spend( REGENERATION_DELAY );
|
||||
|
||||
} else {
|
||||
|
||||
|
|
|
@ -8,69 +8,66 @@ import com.watabou.utils.Bundle;
|
|||
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* Created by debenhame on 19/11/2014.
|
||||
*/
|
||||
public class ToxicImbue extends Buff {
|
||||
|
||||
public static final float DURATION = 30f;
|
||||
public static final float DURATION = 30f;
|
||||
|
||||
protected float left;
|
||||
protected float left;
|
||||
|
||||
private static final String LEFT = "left";
|
||||
private static final String LEFT = "left";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( LEFT, left );
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( LEFT, left );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
left = bundle.getFloat( LEFT );
|
||||
}
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
left = bundle.getFloat( LEFT );
|
||||
}
|
||||
|
||||
public void set( float duration ) {
|
||||
this.left = duration;
|
||||
};
|
||||
public void set( float duration ) {
|
||||
this.left = duration;
|
||||
};
|
||||
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
GameScene.add(Blob.seed(target.pos, 50, ToxicGas.class));
|
||||
@Override
|
||||
public boolean act() {
|
||||
GameScene.add(Blob.seed(target.pos, 50, ToxicGas.class));
|
||||
|
||||
spend(TICK);
|
||||
left -= TICK;
|
||||
if (left <= 0)
|
||||
detach();
|
||||
spend(TICK);
|
||||
left -= TICK;
|
||||
if (left <= 0)
|
||||
detach();
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.IMMUNITY;
|
||||
}
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.IMMUNITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Imbued with Toxicity";
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Imbued with Toxicity";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "You are imbued with poisonous energy!\n" +
|
||||
"\n" +
|
||||
"As you move around toxic gas will constantly billow forth from you, damaging your enemies. " +
|
||||
"You are immune to toxic gas and poison for the duration of the effect.\n" +
|
||||
"\n" +
|
||||
"You are imbued for " + dispTurns(left) + ".";
|
||||
}
|
||||
@Override
|
||||
public String desc() {
|
||||
return "You are imbued with poisonous energy!\n" +
|
||||
"\n" +
|
||||
"As you move around toxic gas will constantly billow forth from you, damaging your enemies. " +
|
||||
"You are immune to toxic gas and poison for the duration of the effect.\n" +
|
||||
"\n" +
|
||||
"You are imbued for " + dispTurns(left) + ".";
|
||||
}
|
||||
|
||||
{
|
||||
immunities.add( ToxicGas.class );
|
||||
immunities.add( Poison.class );
|
||||
}
|
||||
{
|
||||
immunities.add( ToxicGas.class );
|
||||
immunities.add( Poison.class );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,73 +5,70 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.watabou.utils.Bundle;
|
||||
|
||||
/**
|
||||
* Created by Evan on 12/04/2015.
|
||||
*/
|
||||
public class Venom extends Poison implements Hero.Doom {
|
||||
|
||||
private int damage = 1;
|
||||
private int damage = 1;
|
||||
|
||||
private static final String DAMAGE = "damage";
|
||||
private static final String DAMAGE = "damage";
|
||||
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( DAMAGE, damage );
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( DAMAGE, damage );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
damage = bundle.getInt( DAMAGE );
|
||||
}
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
damage = bundle.getInt( DAMAGE );
|
||||
}
|
||||
|
||||
public void set(float duration, int damage) {
|
||||
set(duration);
|
||||
this.damage = damage;
|
||||
}
|
||||
public void set(float duration, int damage) {
|
||||
set(duration);
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.POISON;
|
||||
}
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.POISON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Venomed";
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Venomed";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "Venom is a extremely caustic and dangerous poison.\n" +
|
||||
"\n" +
|
||||
"Unlike poison, whose damage lowers over time, venom does increasing damage the longer it stays on a target.\n" +
|
||||
"\n" +
|
||||
"This venom will last for " + dispTurns(left) + ", and is currently dealing " + damage + " damage.";
|
||||
}
|
||||
@Override
|
||||
public String desc() {
|
||||
return "Venom is a extremely caustic and dangerous poison.\n" +
|
||||
"\n" +
|
||||
"Unlike poison, whose damage lowers over time, venom does increasing damage the longer it stays on a target.\n" +
|
||||
"\n" +
|
||||
"This venom will last for " + dispTurns(left) + ", and is currently dealing " + damage + " damage.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (target.isAlive()) {
|
||||
target.damage(damage, this);
|
||||
if (damage < ((Dungeon.depth+1)/2)+1)
|
||||
damage++;
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (target.isAlive()) {
|
||||
target.damage(damage, this);
|
||||
if (damage < ((Dungeon.depth+1)/2)+1)
|
||||
damage++;
|
||||
|
||||
//want it to act after the cloud of venom it came from.
|
||||
spend( TICK+0.1f );
|
||||
if ((left -= TICK) <= 0) {
|
||||
detach();
|
||||
}
|
||||
} else {
|
||||
detach();
|
||||
}
|
||||
//want it to act after the cloud of venom it came from.
|
||||
spend( TICK+0.1f );
|
||||
if ((left -= TICK) <= 0) {
|
||||
detach();
|
||||
}
|
||||
} else {
|
||||
detach();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,34 +22,34 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
|||
|
||||
public class Vertigo extends FlavourBuff {
|
||||
|
||||
public static final float DURATION = 10f;
|
||||
public static final float DURATION = 10f;
|
||||
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.VERTIGO;
|
||||
}
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.VERTIGO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Vertigo";
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Vertigo";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "Walking in a straight line can be difficult when the whole world is spinning.\n" +
|
||||
"\n" +
|
||||
"While under the effects of vertigo, characters who attempt to move will go in a random direction, " +
|
||||
"instead of the one they intended to go in. \n" +
|
||||
"\n" +
|
||||
"This Vertigo effect with last for " + dispTurns() + ".";
|
||||
}
|
||||
@Override
|
||||
public String desc() {
|
||||
return "Walking in a straight line can be difficult when the whole world is spinning.\n" +
|
||||
"\n" +
|
||||
"While under the effects of vertigo, characters who attempt to move will go in a random direction, " +
|
||||
"instead of the one they intended to go in. \n" +
|
||||
"\n" +
|
||||
"This Vertigo effect with last for " + dispTurns() + ".";
|
||||
}
|
||||
|
||||
public static float duration( Char ch ) {
|
||||
Resistance r = ch.buff( Resistance.class );
|
||||
return r != null ? r.durationFactor() * DURATION : DURATION;
|
||||
}
|
||||
public static float duration( Char ch ) {
|
||||
Resistance r = ch.buff( Resistance.class );
|
||||
return r != null ? r.durationFactor() * DURATION : DURATION;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,16 +128,16 @@ public class Belongings implements Iterable<Item> {
|
|||
return null;
|
||||
}
|
||||
|
||||
public void countIronKeys() {
|
||||
public void countIronKeys() {
|
||||
|
||||
IronKey.curDepthQuantity = 0;
|
||||
IronKey.curDepthQuantity = 0;
|
||||
|
||||
for (Item item : backpack) {
|
||||
if (item instanceof IronKey && ((IronKey)item).depth == Dungeon.depth) {
|
||||
IronKey.curDepthQuantity += item.quantity();
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Item item : backpack) {
|
||||
if (item instanceof IronKey && ((IronKey)item).depth == Dungeon.depth) {
|
||||
IronKey.curDepthQuantity += item.quantity();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void identify() {
|
||||
for (Item item : this) {
|
||||
|
|
|
@ -152,8 +152,8 @@ public class Hero extends Char {
|
|||
private int defenseSkill = 5;
|
||||
|
||||
public boolean ready = false;
|
||||
private boolean damageInterrupt = true;
|
||||
public HeroAction curAction = null;
|
||||
private boolean damageInterrupt = true;
|
||||
public HeroAction curAction = null;
|
||||
public HeroAction lastAction = null;
|
||||
|
||||
private Char enemy;
|
||||
|
@ -162,7 +162,7 @@ public class Hero extends Char {
|
|||
|
||||
public boolean restoreHealth = false;
|
||||
|
||||
public MissileWeapon rangedWeapon = null;
|
||||
public MissileWeapon rangedWeapon = null;
|
||||
public Belongings belongings;
|
||||
|
||||
public int STR;
|
||||
|
@ -189,11 +189,11 @@ public class Hero extends Char {
|
|||
}
|
||||
|
||||
public int STR() {
|
||||
int STR = this.STR;
|
||||
int STR = this.STR;
|
||||
|
||||
for (Buff buff : buffs(RingOfMight.Might.class)) {
|
||||
STR += ((RingOfMight.Might)buff).level;
|
||||
}
|
||||
for (Buff buff : buffs(RingOfMight.Might.class)) {
|
||||
STR += ((RingOfMight.Might)buff).level;
|
||||
}
|
||||
|
||||
return weakened ? STR - 2 : STR;
|
||||
}
|
||||
|
@ -263,29 +263,29 @@ public class Hero extends Char {
|
|||
return belongings.armor == null ? 0 : belongings.armor.tier;
|
||||
}
|
||||
|
||||
public boolean shoot( Char enemy, MissileWeapon wep ) {
|
||||
public boolean shoot( Char enemy, MissileWeapon wep ) {
|
||||
|
||||
rangedWeapon = wep;
|
||||
boolean result = attack( enemy );
|
||||
Invisibility.dispel();
|
||||
rangedWeapon = null;
|
||||
rangedWeapon = wep;
|
||||
boolean result = attack( enemy );
|
||||
Invisibility.dispel();
|
||||
rangedWeapon = null;
|
||||
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int attackSkill( Char target ) {
|
||||
float accuracy = 1;
|
||||
if (rangedWeapon != null && Level.distance( pos, target.pos ) == 1) {
|
||||
accuracy *= 0.5f;
|
||||
}
|
||||
float accuracy = 1;
|
||||
if (rangedWeapon != null && Level.distance( pos, target.pos ) == 1) {
|
||||
accuracy *= 0.5f;
|
||||
}
|
||||
|
||||
KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
|
||||
if (wep != null) {
|
||||
return (int)(attackSkill * accuracy * wep.acuracyFactor( this ));
|
||||
} else {
|
||||
return (int)(attackSkill * accuracy);
|
||||
}
|
||||
KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
|
||||
if (wep != null) {
|
||||
return (int)(attackSkill * accuracy * wep.acuracyFactor( this ));
|
||||
} else {
|
||||
return (int)(attackSkill * accuracy);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -327,12 +327,12 @@ public class Hero extends Char {
|
|||
|
||||
@Override
|
||||
public int damageRoll() {
|
||||
KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
|
||||
KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
|
||||
int dmg;
|
||||
int bonus = 0;
|
||||
for (Buff buff : buffs( RingOfForce.Force.class )) {
|
||||
bonus += ((RingOfForce.Force)buff).level;
|
||||
}
|
||||
int bonus = 0;
|
||||
for (Buff buff : buffs( RingOfForce.Force.class )) {
|
||||
bonus += ((RingOfForce.Force)buff).level;
|
||||
}
|
||||
|
||||
if (wep != null) {
|
||||
dmg = wep.damageRoll( this ) + bonus;
|
||||
|
@ -351,15 +351,15 @@ public class Hero extends Char {
|
|||
@Override
|
||||
public float speed() {
|
||||
|
||||
float speed = super.speed();
|
||||
float speed = super.speed();
|
||||
|
||||
int hasteLevel = 0;
|
||||
for (Buff buff : buffs( RingOfHaste.Haste.class )) {
|
||||
hasteLevel += ((RingOfHaste.Haste)buff).level;
|
||||
}
|
||||
int hasteLevel = 0;
|
||||
for (Buff buff : buffs( RingOfHaste.Haste.class )) {
|
||||
hasteLevel += ((RingOfHaste.Haste)buff).level;
|
||||
}
|
||||
|
||||
if (hasteLevel != 0)
|
||||
speed *= Math.pow(1.2, hasteLevel);
|
||||
if (hasteLevel != 0)
|
||||
speed *= Math.pow(1.2, hasteLevel);
|
||||
|
||||
int aEnc = belongings.armor != null ? belongings.armor.STR - STR() : 0;
|
||||
if (aEnc > 0) {
|
||||
|
@ -378,29 +378,29 @@ public class Hero extends Char {
|
|||
}
|
||||
|
||||
public float attackDelay() {
|
||||
KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
|
||||
KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
|
||||
if (wep != null) {
|
||||
|
||||
return wep.speedFactor( this );
|
||||
|
||||
} else {
|
||||
//Normally putting furor speed on unarmed attacks would be unnecessary
|
||||
//But there's going to be that one guy who gets a furor+force ring combo
|
||||
//This is for that one guy, you shall get your fists of fury!
|
||||
int bonus = 0;
|
||||
for (Buff buff : buffs(RingOfFuror.Furor.class)) {
|
||||
bonus += ((RingOfFuror.Furor)buff).level;
|
||||
}
|
||||
//Normally putting furor speed on unarmed attacks would be unnecessary
|
||||
//But there's going to be that one guy who gets a furor+force ring combo
|
||||
//This is for that one guy, you shall get your fists of fury!
|
||||
int bonus = 0;
|
||||
for (Buff buff : buffs(RingOfFuror.Furor.class)) {
|
||||
bonus += ((RingOfFuror.Furor)buff).level;
|
||||
}
|
||||
return (float)(0.25 + (1 - 0.25)*Math.pow(0.8, bonus));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spend( float time ) {
|
||||
TimekeepersHourglass.timeFreeze buff = buff(TimekeepersHourglass.timeFreeze.class);
|
||||
if (!(buff != null && buff.processTime(time)))
|
||||
super.spend( time );
|
||||
}
|
||||
@Override
|
||||
public void spend( float time ) {
|
||||
TimekeepersHourglass.timeFreeze buff = buff(TimekeepersHourglass.timeFreeze.class);
|
||||
if (!(buff != null && buff.processTime(time)))
|
||||
super.spend( time );
|
||||
}
|
||||
|
||||
public void spendAndNext( float time ) {
|
||||
busy();
|
||||
|
@ -436,7 +436,7 @@ public class Hero extends Char {
|
|||
}
|
||||
|
||||
ready();
|
||||
return false;
|
||||
return false;
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -451,47 +451,47 @@ public class Hero extends Char {
|
|||
} else
|
||||
if (curAction instanceof HeroAction.Interact) {
|
||||
|
||||
return actInteract( (HeroAction.Interact)curAction );
|
||||
return actInteract( (HeroAction.Interact)curAction );
|
||||
|
||||
} else
|
||||
if (curAction instanceof HeroAction.Buy) {
|
||||
|
||||
return actBuy( (HeroAction.Buy)curAction );
|
||||
return actBuy( (HeroAction.Buy)curAction );
|
||||
|
||||
}else
|
||||
if (curAction instanceof HeroAction.PickUp) {
|
||||
|
||||
return actPickUp( (HeroAction.PickUp)curAction );
|
||||
return actPickUp( (HeroAction.PickUp)curAction );
|
||||
|
||||
} else
|
||||
if (curAction instanceof HeroAction.OpenChest) {
|
||||
|
||||
return actOpenChest( (HeroAction.OpenChest)curAction );
|
||||
return actOpenChest( (HeroAction.OpenChest)curAction );
|
||||
|
||||
} else
|
||||
if (curAction instanceof HeroAction.Unlock) {
|
||||
|
||||
return actUnlock((HeroAction.Unlock) curAction);
|
||||
return actUnlock((HeroAction.Unlock) curAction);
|
||||
|
||||
} else
|
||||
if (curAction instanceof HeroAction.Descend) {
|
||||
|
||||
return actDescend( (HeroAction.Descend)curAction );
|
||||
return actDescend( (HeroAction.Descend)curAction );
|
||||
|
||||
} else
|
||||
if (curAction instanceof HeroAction.Ascend) {
|
||||
|
||||
return actAscend( (HeroAction.Ascend)curAction );
|
||||
return actAscend( (HeroAction.Ascend)curAction );
|
||||
|
||||
} else
|
||||
if (curAction instanceof HeroAction.Attack) {
|
||||
|
||||
return actAttack( (HeroAction.Attack)curAction );
|
||||
return actAttack( (HeroAction.Attack)curAction );
|
||||
|
||||
} else
|
||||
if (curAction instanceof HeroAction.Cook) {
|
||||
|
||||
return actCook( (HeroAction.Cook)curAction );
|
||||
return actCook( (HeroAction.Cook)curAction );
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -506,10 +506,10 @@ public class Hero extends Char {
|
|||
private void ready() {
|
||||
sprite.idle();
|
||||
curAction = null;
|
||||
damageInterrupt = true;
|
||||
damageInterrupt = true;
|
||||
ready = true;
|
||||
|
||||
AttackIndicator.updateState();
|
||||
AttackIndicator.updateState();
|
||||
|
||||
GameScene.ready();
|
||||
}
|
||||
|
@ -524,7 +524,7 @@ public class Hero extends Char {
|
|||
public void resume() {
|
||||
curAction = lastAction;
|
||||
lastAction = null;
|
||||
damageInterrupt = false;
|
||||
damageInterrupt = false;
|
||||
act();
|
||||
}
|
||||
|
||||
|
@ -532,7 +532,7 @@ public class Hero extends Char {
|
|||
|
||||
if (getCloser( action.dst )) {
|
||||
|
||||
return true;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
if (Dungeon.level.map[pos] == Terrain.SIGN) {
|
||||
|
@ -540,7 +540,7 @@ public class Hero extends Char {
|
|||
}
|
||||
ready();
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -553,17 +553,17 @@ public class Hero extends Char {
|
|||
ready();
|
||||
sprite.turnTo( pos, npc.pos );
|
||||
npc.interact();
|
||||
return false;
|
||||
return false;
|
||||
|
||||
} else {
|
||||
|
||||
if (Level.fieldOfView[npc.pos] && getCloser( npc.pos )) {
|
||||
|
||||
return true;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
ready();
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -580,15 +580,15 @@ public class Hero extends Char {
|
|||
GameScene.show( new WndTradeItem( heap, true ) );
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
|
||||
} else if (getCloser( dst )) {
|
||||
|
||||
return true;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
ready();
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -598,15 +598,15 @@ public class Hero extends Char {
|
|||
|
||||
ready();
|
||||
AlchemyPot.operate( this, dst );
|
||||
return false;
|
||||
return false;
|
||||
|
||||
} else if (getCloser( dst )) {
|
||||
|
||||
return true;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
ready();
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -620,8 +620,8 @@ public class Hero extends Char {
|
|||
if (item.doPickUp( this )) {
|
||||
|
||||
if (item instanceof Dewdrop
|
||||
|| item instanceof TimekeepersHourglass.sandBag
|
||||
|| item instanceof DriedRose.Petal) {
|
||||
|| item instanceof TimekeepersHourglass.sandBag
|
||||
|| item instanceof DriedRose.Petal) {
|
||||
//Do Nothing
|
||||
} else {
|
||||
|
||||
|
@ -645,17 +645,17 @@ public class Hero extends Char {
|
|||
}
|
||||
} else {
|
||||
ready();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
|
||||
} else if (getCloser( dst )) {
|
||||
} else if (getCloser( dst )) {
|
||||
|
||||
return true;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
ready();
|
||||
return false;
|
||||
} else {
|
||||
ready();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -685,7 +685,7 @@ public class Hero extends Char {
|
|||
Camera.main.shake( 1, 0.5f );
|
||||
break;
|
||||
case SKELETON:
|
||||
case REMAINS:
|
||||
case REMAINS:
|
||||
break;
|
||||
default:
|
||||
Sample.INSTANCE.play( Assets.SND_UNLOCK );
|
||||
|
@ -696,18 +696,18 @@ public class Hero extends Char {
|
|||
|
||||
} else {
|
||||
ready();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
|
||||
} else if (getCloser( dst )) {
|
||||
} else if (getCloser( dst )) {
|
||||
|
||||
return true;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
ready();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
ready();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean actUnlock( HeroAction.Unlock action ) {
|
||||
|
@ -737,18 +737,18 @@ public class Hero extends Char {
|
|||
} else {
|
||||
GLog.w( TXT_LOCKED_DOOR );
|
||||
ready();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
|
||||
} else if (getCloser( doorCell )) {
|
||||
} else if (getCloser( doorCell )) {
|
||||
|
||||
return true;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
ready();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
ready();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean actDescend( HeroAction.Descend action ) {
|
||||
|
@ -760,22 +760,22 @@ public class Hero extends Char {
|
|||
Buff buff = buff(TimekeepersHourglass.timeFreeze.class);
|
||||
if (buff != null) buff.detach();
|
||||
|
||||
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] ))
|
||||
if (mob instanceof DriedRose.GhostHero) mob.destroy();
|
||||
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] ))
|
||||
if (mob instanceof DriedRose.GhostHero) mob.destroy();
|
||||
|
||||
InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
|
||||
Game.switchScene( InterlevelScene.class );
|
||||
Game.switchScene( InterlevelScene.class );
|
||||
|
||||
return false;
|
||||
return false;
|
||||
|
||||
} else if (getCloser( stairs )) {
|
||||
} else if (getCloser( stairs )) {
|
||||
|
||||
return true;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
ready();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
ready();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean actAscend( HeroAction.Ascend action ) {
|
||||
|
@ -788,7 +788,7 @@ public class Hero extends Char {
|
|||
GameScene.show( new WndMessage( TXT_LEAVE ) );
|
||||
ready();
|
||||
} else {
|
||||
Dungeon.win( ResultDescriptions.WIN );
|
||||
Dungeon.win( ResultDescriptions.WIN );
|
||||
Dungeon.deleteGame( Dungeon.hero.heroClass, true );
|
||||
Game.switchScene( SurfaceScene.class );
|
||||
}
|
||||
|
@ -805,23 +805,23 @@ public class Hero extends Char {
|
|||
Buff buff = buff(TimekeepersHourglass.timeFreeze.class);
|
||||
if (buff != null) buff.detach();
|
||||
|
||||
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] ))
|
||||
if (mob instanceof DriedRose.GhostHero) mob.destroy();
|
||||
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] ))
|
||||
if (mob instanceof DriedRose.GhostHero) mob.destroy();
|
||||
|
||||
InterlevelScene.mode = InterlevelScene.Mode.ASCEND;
|
||||
Game.switchScene( InterlevelScene.class );
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
|
||||
} else if (getCloser( stairs )) {
|
||||
} else if (getCloser( stairs )) {
|
||||
|
||||
return true;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
ready();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
ready();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean actAttack( HeroAction.Attack action ) {
|
||||
|
@ -831,22 +831,22 @@ public class Hero extends Char {
|
|||
if (Level.adjacent( pos, enemy.pos ) && enemy.isAlive() && !isCharmedBy( enemy )) {
|
||||
|
||||
spend( attackDelay() );
|
||||
sprite.attack( enemy.pos );
|
||||
sprite.attack( enemy.pos );
|
||||
|
||||
return false;
|
||||
return false;
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
if (Level.fieldOfView[enemy.pos] && getCloser( enemy.pos )) {
|
||||
if (Level.fieldOfView[enemy.pos] && getCloser( enemy.pos )) {
|
||||
|
||||
return true;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
ready();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
ready();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void rest( boolean tillHealthy ) {
|
||||
|
@ -859,7 +859,7 @@ public class Hero extends Char {
|
|||
|
||||
@Override
|
||||
public int attackProc( Char enemy, int damage ) {
|
||||
KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
|
||||
KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
|
||||
|
||||
if (wep != null) wep.proc( this, enemy, damage );
|
||||
|
||||
|
@ -889,10 +889,10 @@ public class Hero extends Char {
|
|||
damage = armor.absorb( damage );
|
||||
}
|
||||
|
||||
Sungrass.Health health = buff( Sungrass.Health.class );
|
||||
if (health != null) {
|
||||
health.absorb( damage );
|
||||
}
|
||||
Sungrass.Health health = buff( Sungrass.Health.class );
|
||||
if (health != null) {
|
||||
health.absorb( damage );
|
||||
}
|
||||
|
||||
if (belongings.armor != null) {
|
||||
damage = belongings.armor.proc( enemy, this, damage );
|
||||
|
@ -909,24 +909,24 @@ public class Hero extends Char {
|
|||
restoreHealth = false;
|
||||
|
||||
if (!(src instanceof Hunger || src instanceof Viscosity.DeferedDamage) && damageInterrupt)
|
||||
interrupt();
|
||||
interrupt();
|
||||
|
||||
if (this.buff(Drowsy.class) != null){
|
||||
Buff.detach(this, Drowsy.class);
|
||||
GLog.w("The pain helps you resist the urge to sleep.");
|
||||
}
|
||||
if (this.buff(Drowsy.class) != null){
|
||||
Buff.detach(this, Drowsy.class);
|
||||
GLog.w("The pain helps you resist the urge to sleep.");
|
||||
}
|
||||
|
||||
CapeOfThorns.Thorns thorns = buff( CapeOfThorns.Thorns.class );
|
||||
if (thorns != null) {
|
||||
dmg = thorns.proc(dmg, (src instanceof Char ? (Char)src : null), this);
|
||||
}
|
||||
|
||||
int tenacity = 0;
|
||||
for (Buff buff : buffs(RingOfTenacity.Tenacity.class)) {
|
||||
tenacity += ((RingOfTenacity.Tenacity)buff).level;
|
||||
}
|
||||
if (tenacity != 0) //(HT - HP)/HT = heroes current % missing health.
|
||||
dmg = (int)Math.ceil((float)dmg * Math.pow(0.9, tenacity*((float)(HT - HP)/HT)));
|
||||
int tenacity = 0;
|
||||
for (Buff buff : buffs(RingOfTenacity.Tenacity.class)) {
|
||||
tenacity += ((RingOfTenacity.Tenacity)buff).level;
|
||||
}
|
||||
if (tenacity != 0) //(HT - HP)/HT = heroes current % missing health.
|
||||
dmg = (int)Math.ceil((float)dmg * Math.pow(0.9, tenacity*((float)(HT - HP)/HT)));
|
||||
|
||||
super.damage( dmg, src );
|
||||
|
||||
|
@ -979,9 +979,9 @@ public class Hero extends Char {
|
|||
if (Actor.findChar( target ) == null) {
|
||||
if (Level.pit[target] && !flying && !Chasm.jumpConfirmed) {
|
||||
if (!Level.solid[target]) {
|
||||
Chasm.heroJump(this);
|
||||
interrupt();
|
||||
}
|
||||
Chasm.heroJump(this);
|
||||
interrupt();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (Level.passable[target] || Level.avoid[target]) {
|
||||
|
@ -1005,9 +1005,9 @@ public class Hero extends Char {
|
|||
|
||||
if (step != -1) {
|
||||
|
||||
int oldPos = pos;
|
||||
move(step);
|
||||
sprite.move(oldPos, pos);
|
||||
int oldPos = pos;
|
||||
move(step);
|
||||
sprite.move(oldPos, pos);
|
||||
spend( 1 / speed() );
|
||||
|
||||
return true;
|
||||
|
@ -1182,13 +1182,13 @@ public class Hero extends Char {
|
|||
} else if (buff instanceof Bleeding) {
|
||||
GLog.w( "You are bleeding!" );
|
||||
} else if (buff instanceof RingOfMight.Might){
|
||||
if (((RingOfMight.Might)buff).level > 0) {
|
||||
HT += ((RingOfMight.Might) buff).level * 5;
|
||||
}
|
||||
} else if (buff instanceof Vertigo) {
|
||||
GLog.w("Everything is spinning around you!");
|
||||
interrupt();
|
||||
}
|
||||
if (((RingOfMight.Might)buff).level > 0) {
|
||||
HT += ((RingOfMight.Might) buff).level * 5;
|
||||
}
|
||||
} else if (buff instanceof Vertigo) {
|
||||
GLog.w("Everything is spinning around you!");
|
||||
interrupt();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1200,11 +1200,11 @@ public class Hero extends Char {
|
|||
super.remove( buff );
|
||||
|
||||
if (buff instanceof RingOfMight.Might){
|
||||
if (((RingOfMight.Might)buff).level > 0){
|
||||
HT -= ((RingOfMight.Might) buff).level * 5;
|
||||
HP = Math.min(HT, HP);
|
||||
}
|
||||
}
|
||||
if (((RingOfMight.Might)buff).level > 0){
|
||||
HT -= ((RingOfMight.Might) buff).level * 5;
|
||||
HP = Math.min(HT, HP);
|
||||
}
|
||||
}
|
||||
|
||||
BuffIndicator.refreshHero();
|
||||
}
|
||||
|
@ -1223,35 +1223,35 @@ public class Hero extends Char {
|
|||
|
||||
curAction = null;
|
||||
|
||||
Ankh ankh = null;
|
||||
Ankh ankh = null;
|
||||
|
||||
//look for ankhs in player inventory, prioritize ones which are blessed.
|
||||
for (Item item : belongings){
|
||||
if (item instanceof Ankh) {
|
||||
if (ankh == null || ((Ankh) item).isBlessed()) {
|
||||
ankh = (Ankh) item;
|
||||
}
|
||||
}
|
||||
}
|
||||
//look for ankhs in player inventory, prioritize ones which are blessed.
|
||||
for (Item item : belongings){
|
||||
if (item instanceof Ankh) {
|
||||
if (ankh == null || ((Ankh) item).isBlessed()) {
|
||||
ankh = (Ankh) item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ankh != null && ankh.isBlessed()) {
|
||||
this.HP = HT/4;
|
||||
if (ankh != null && ankh.isBlessed()) {
|
||||
this.HP = HT/4;
|
||||
|
||||
//ensures that you'll get to act first in almost any case, to prevent reviving and then instantly dieing again.
|
||||
Buff.detach(this, Paralysis.class);
|
||||
spend(-cooldown());
|
||||
//ensures that you'll get to act first in almost any case, to prevent reviving and then instantly dieing again.
|
||||
Buff.detach(this, Paralysis.class);
|
||||
spend(-cooldown());
|
||||
|
||||
new Flare(8, 32).color(0xFFFF66, true).show(sprite, 2f);
|
||||
CellEmitter.get(this.pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
|
||||
new Flare(8, 32).color(0xFFFF66, true).show(sprite, 2f);
|
||||
CellEmitter.get(this.pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
|
||||
|
||||
ankh.detach(belongings.backpack);
|
||||
ankh.detach(belongings.backpack);
|
||||
|
||||
Sample.INSTANCE.play( Assets.SND_TELEPORT );
|
||||
GLog.w( ankh.TXT_REVIVE );
|
||||
Statistics.ankhsUsed++;
|
||||
Sample.INSTANCE.play( Assets.SND_TELEPORT );
|
||||
GLog.w( ankh.TXT_REVIVE );
|
||||
Statistics.ankhsUsed++;
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Actor.fixTime();
|
||||
super.die( cause );
|
||||
|
@ -1429,7 +1429,7 @@ public class Hero extends Char {
|
|||
by = Level.HEIGHT - 1;
|
||||
}
|
||||
|
||||
TalismanOfForesight.Foresight foresight = buff( TalismanOfForesight.Foresight.class );
|
||||
TalismanOfForesight.Foresight foresight = buff( TalismanOfForesight.Foresight.class );
|
||||
|
||||
//cursed talisman of foresight makes unintentionally finding things impossible.
|
||||
if (foresight != null && foresight.isCursed()){
|
||||
|
@ -1457,8 +1457,8 @@ public class Hero extends Char {
|
|||
|
||||
smthFound = true;
|
||||
|
||||
if (foresight != null && !foresight.isCursed())
|
||||
foresight.charge();
|
||||
if (foresight != null && !foresight.isCursed())
|
||||
foresight.charge();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1505,11 +1505,11 @@ public class Hero extends Char {
|
|||
|
||||
@Override
|
||||
public HashSet<Class<?>> immunities() {
|
||||
HashSet<Class<?>> immunities = new HashSet<Class<?>>();
|
||||
HashSet<Class<?>> immunities = new HashSet<Class<?>>();
|
||||
for (Buff buff : buffs()){
|
||||
for (Class<?> immunity : buff.immunities)
|
||||
immunities.add(immunity);
|
||||
}
|
||||
for (Class<?> immunity : buff.immunities)
|
||||
immunities.add(immunity);
|
||||
}
|
||||
return immunities;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,110 +83,110 @@ public enum HeroClass {
|
|||
"Potions of Mind Vision are identified from the beginning."
|
||||
};
|
||||
|
||||
public void initHero( Hero hero ) {
|
||||
public void initHero( Hero hero ) {
|
||||
|
||||
hero.heroClass = this;
|
||||
hero.heroClass = this;
|
||||
|
||||
initCommon( hero );
|
||||
initCommon( hero );
|
||||
|
||||
switch (this) {
|
||||
case WARRIOR:
|
||||
initWarrior( hero );
|
||||
break;
|
||||
switch (this) {
|
||||
case WARRIOR:
|
||||
initWarrior( hero );
|
||||
break;
|
||||
|
||||
case MAGE:
|
||||
initMage( hero );
|
||||
break;
|
||||
case MAGE:
|
||||
initMage( hero );
|
||||
break;
|
||||
|
||||
case ROGUE:
|
||||
initRogue( hero );
|
||||
break;
|
||||
case ROGUE:
|
||||
initRogue( hero );
|
||||
break;
|
||||
|
||||
case HUNTRESS:
|
||||
initHuntress( hero );
|
||||
break;
|
||||
}
|
||||
case HUNTRESS:
|
||||
initHuntress( hero );
|
||||
break;
|
||||
}
|
||||
|
||||
if (Badges.isUnlocked( masteryBadge() )) {
|
||||
new TomeOfMastery().collect();
|
||||
}
|
||||
if (Badges.isUnlocked( masteryBadge() )) {
|
||||
new TomeOfMastery().collect();
|
||||
}
|
||||
|
||||
hero.updateAwareness();
|
||||
}
|
||||
hero.updateAwareness();
|
||||
}
|
||||
|
||||
private static void initCommon( Hero hero ) {
|
||||
if (!Dungeon.isChallenged(Challenges.NO_ARMOR))
|
||||
(hero.belongings.armor = new ClothArmor()).identify();
|
||||
private static void initCommon( Hero hero ) {
|
||||
if (!Dungeon.isChallenged(Challenges.NO_ARMOR))
|
||||
(hero.belongings.armor = new ClothArmor()).identify();
|
||||
|
||||
if (!Dungeon.isChallenged(Challenges.NO_FOOD))
|
||||
new Food().identify().collect();
|
||||
}
|
||||
if (!Dungeon.isChallenged(Challenges.NO_FOOD))
|
||||
new Food().identify().collect();
|
||||
}
|
||||
|
||||
public Badges.Badge masteryBadge() {
|
||||
switch (this) {
|
||||
case WARRIOR:
|
||||
return Badges.Badge.MASTERY_WARRIOR;
|
||||
case MAGE:
|
||||
return Badges.Badge.MASTERY_MAGE;
|
||||
case ROGUE:
|
||||
return Badges.Badge.MASTERY_ROGUE;
|
||||
case HUNTRESS:
|
||||
return Badges.Badge.MASTERY_HUNTRESS;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public Badges.Badge masteryBadge() {
|
||||
switch (this) {
|
||||
case WARRIOR:
|
||||
return Badges.Badge.MASTERY_WARRIOR;
|
||||
case MAGE:
|
||||
return Badges.Badge.MASTERY_MAGE;
|
||||
case ROGUE:
|
||||
return Badges.Badge.MASTERY_ROGUE;
|
||||
case HUNTRESS:
|
||||
return Badges.Badge.MASTERY_HUNTRESS;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void initWarrior( Hero hero ) {
|
||||
hero.STR = hero.STR + 1;
|
||||
private static void initWarrior( Hero hero ) {
|
||||
hero.STR = hero.STR + 1;
|
||||
|
||||
(hero.belongings.weapon = new ShortSword()).identify();
|
||||
Dart darts = new Dart( 8 );
|
||||
darts.identify().collect();
|
||||
(hero.belongings.weapon = new ShortSword()).identify();
|
||||
Dart darts = new Dart( 8 );
|
||||
darts.identify().collect();
|
||||
|
||||
Dungeon.quickslot.setSlot(0, darts);
|
||||
Dungeon.quickslot.setSlot(0, darts);
|
||||
|
||||
new PotionOfStrength().setKnown();
|
||||
}
|
||||
new PotionOfStrength().setKnown();
|
||||
}
|
||||
|
||||
private static void initMage( Hero hero ) {
|
||||
MagesStaff staff = new MagesStaff(new WandOfMagicMissile());
|
||||
(hero.belongings.weapon = staff).identify();
|
||||
hero.belongings.weapon.activate(hero);
|
||||
private static void initMage( Hero hero ) {
|
||||
MagesStaff staff = new MagesStaff(new WandOfMagicMissile());
|
||||
(hero.belongings.weapon = staff).identify();
|
||||
hero.belongings.weapon.activate(hero);
|
||||
|
||||
Dungeon.quickslot.setSlot(0, staff);
|
||||
Dungeon.quickslot.setSlot(0, staff);
|
||||
|
||||
new ScrollOfUpgrade().setKnown();
|
||||
}
|
||||
new ScrollOfUpgrade().setKnown();
|
||||
}
|
||||
|
||||
private static void initRogue( Hero hero ) {
|
||||
(hero.belongings.weapon = new Dagger()).identify();
|
||||
private static void initRogue( Hero hero ) {
|
||||
(hero.belongings.weapon = new Dagger()).identify();
|
||||
|
||||
CloakOfShadows cloak = new CloakOfShadows();
|
||||
(hero.belongings.misc1 = cloak).identify();
|
||||
hero.belongings.misc1.activate( hero );
|
||||
CloakOfShadows cloak = new CloakOfShadows();
|
||||
(hero.belongings.misc1 = cloak).identify();
|
||||
hero.belongings.misc1.activate( hero );
|
||||
|
||||
Dart darts = new Dart( 8 );
|
||||
darts.identify().collect();
|
||||
Dart darts = new Dart( 8 );
|
||||
darts.identify().collect();
|
||||
|
||||
Dungeon.quickslot.setSlot(0, cloak);
|
||||
if (ShatteredPixelDungeon.quickSlots() > 1)
|
||||
Dungeon.quickslot.setSlot(1, darts);
|
||||
Dungeon.quickslot.setSlot(0, cloak);
|
||||
if (ShatteredPixelDungeon.quickSlots() > 1)
|
||||
Dungeon.quickslot.setSlot(1, darts);
|
||||
|
||||
new ScrollOfMagicMapping().setKnown();
|
||||
}
|
||||
new ScrollOfMagicMapping().setKnown();
|
||||
}
|
||||
|
||||
private static void initHuntress( Hero hero ) {
|
||||
private static void initHuntress( Hero hero ) {
|
||||
|
||||
hero.HP = (hero.HT -= 5);
|
||||
hero.HP = (hero.HT -= 5);
|
||||
|
||||
(hero.belongings.weapon = new Dagger()).identify();
|
||||
Boomerang boomerang = new Boomerang();
|
||||
boomerang.identify().collect();
|
||||
(hero.belongings.weapon = new Dagger()).identify();
|
||||
Boomerang boomerang = new Boomerang();
|
||||
boomerang.identify().collect();
|
||||
|
||||
Dungeon.quickslot.setSlot(0, boomerang);
|
||||
Dungeon.quickslot.setSlot(0, boomerang);
|
||||
|
||||
new PotionOfMindVision().setKnown();
|
||||
}
|
||||
new PotionOfMindVision().setKnown();
|
||||
}
|
||||
|
||||
public String title() {
|
||||
return title;
|
||||
|
|
|
@ -48,9 +48,9 @@ public class Albino extends Rat {
|
|||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return
|
||||
"This is a rare breed of marsupial rat, with pure white fur and jagged teeth.";
|
||||
}
|
||||
@Override
|
||||
public String description() {
|
||||
return
|
||||
"This is a rare breed of marsupial rat, with pure white fur and jagged teeth.";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,8 +37,8 @@ public class Bandit extends Thief {
|
|||
name = "crazy bandit";
|
||||
spriteClass = BanditSprite.class;
|
||||
|
||||
//1 in 30 chance to be a crazy bandit, equates to overall 1/90 chance.
|
||||
lootChance = 0.333f;
|
||||
//1 in 30 chance to be a crazy bandit, equates to overall 1/90 chance.
|
||||
lootChance = 0.333f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,8 +46,8 @@ public class Bandit extends Thief {
|
|||
if (super.steal( hero )) {
|
||||
|
||||
Buff.prolong( hero, Blindness.class, Random.Int( 5, 12 ) );
|
||||
Buff.affect( hero, Poison.class ).set(Random.Int(5, 7) * Poison.durationFactor(enemy));
|
||||
Buff.prolong( hero, Cripple.class, Cripple.DURATION );
|
||||
Buff.affect( hero, Poison.class ).set(Random.Int(5, 7) * Poison.durationFactor(enemy));
|
||||
Buff.prolong( hero, Cripple.class, Cripple.DURATION );
|
||||
Dungeon.observe();
|
||||
|
||||
return true;
|
||||
|
|
|
@ -80,18 +80,18 @@ public class Bat extends Mob {
|
|||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die( Object cause ){
|
||||
//sets drop chance
|
||||
lootChance = 1f/((6 + Dungeon.limitedDrops.batHP.count ));
|
||||
super.die( cause );
|
||||
}
|
||||
@Override
|
||||
public void die( Object cause ){
|
||||
//sets drop chance
|
||||
lootChance = 1f/((6 + Dungeon.limitedDrops.batHP.count ));
|
||||
super.die( cause );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Item createLoot(){
|
||||
Dungeon.limitedDrops.batHP.count++;
|
||||
return super.createLoot();
|
||||
}
|
||||
@Override
|
||||
protected Item createLoot(){
|
||||
Dungeon.limitedDrops.batHP.count++;
|
||||
return super.createLoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
|
|
|
@ -49,23 +49,23 @@ public class Bee extends Mob {
|
|||
private int potHolder;
|
||||
|
||||
private static final String LEVEL = "level";
|
||||
private static final String POTPOS = "potpos";
|
||||
private static final String POTHOLDER = "potholder";
|
||||
private static final String POTPOS = "potpos";
|
||||
private static final String POTHOLDER = "potholder";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( LEVEL, level );
|
||||
bundle.put( POTPOS, potPos );
|
||||
bundle.put( POTHOLDER, potHolder );
|
||||
bundle.put( POTPOS, potPos );
|
||||
bundle.put( POTHOLDER, potHolder );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
spawn( bundle.getInt( LEVEL ) );
|
||||
potPos = bundle.getInt( POTPOS );
|
||||
potHolder = bundle.getInt( POTHOLDER );
|
||||
potPos = bundle.getInt( POTPOS );
|
||||
potHolder = bundle.getInt( POTHOLDER );
|
||||
}
|
||||
|
||||
public void spawn( int level ) {
|
||||
|
@ -103,37 +103,37 @@ public class Bee extends Mob {
|
|||
|
||||
@Override
|
||||
protected Char chooseEnemy() {
|
||||
//if the pot is no longer present, target the hero
|
||||
//if the pot is no longer present, target the hero
|
||||
if (potHolder == -1 && potPos == -1)
|
||||
return Dungeon.hero;
|
||||
|
||||
//if something is holding the pot, target that
|
||||
//if something is holding the pot, target that
|
||||
else if (Actor.findById(potHolder) != null)
|
||||
return (Char)Actor.findById(potHolder);
|
||||
|
||||
//if the pot is on the ground
|
||||
//if the pot is on the ground
|
||||
else {
|
||||
|
||||
//if already targeting something, and that thing is still alive and near the pot, keeping targeting it.
|
||||
if (enemy != null && enemy.isAlive() && Level.distance(enemy.pos, potPos) <= 3) return enemy;
|
||||
//if already targeting something, and that thing is still alive and near the pot, keeping targeting it.
|
||||
if (enemy != null && enemy.isAlive() && Level.distance(enemy.pos, potPos) <= 3) return enemy;
|
||||
|
||||
//find all mobs near the pot
|
||||
HashSet<Char> enemies = new HashSet<Char>();
|
||||
for (Mob mob : Dungeon.level.mobs)
|
||||
if (!(mob instanceof Bee) && Level.distance(mob.pos, potPos) <= 3 && (mob.hostile || mob.ally))
|
||||
enemies.add(mob);
|
||||
//find all mobs near the pot
|
||||
HashSet<Char> enemies = new HashSet<Char>();
|
||||
for (Mob mob : Dungeon.level.mobs)
|
||||
if (!(mob instanceof Bee) && Level.distance(mob.pos, potPos) <= 3 && (mob.hostile || mob.ally))
|
||||
enemies.add(mob);
|
||||
|
||||
//pick one, if there are none, check if the hero is near the pot, go for them, otherwise go for nothing.
|
||||
if (enemies.size() > 0) return Random.element(enemies);
|
||||
else return (Level.distance(Dungeon.hero.pos, potPos) <= 3) ? Dungeon.hero : null ;
|
||||
}
|
||||
//pick one, if there are none, check if the hero is near the pot, go for them, otherwise go for nothing.
|
||||
if (enemies.size() > 0) return Random.element(enemies);
|
||||
else return (Level.distance(Dungeon.hero.pos, potPos) <= 3) ? Dungeon.hero : null ;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean getCloser(int target) {
|
||||
if (enemy != null && Actor.findById(potHolder) == enemy) {
|
||||
target = enemy.pos;
|
||||
} else if (potPos != -1 && (state == WANDERING || Level.distance(target, potPos) > 3))
|
||||
if (enemy != null && Actor.findById(potHolder) == enemy) {
|
||||
target = enemy.pos;
|
||||
} else if (potPos != -1 && (state == WANDERING || Level.distance(target, potPos) > 3))
|
||||
this.target = target = potPos;
|
||||
return super.getCloser( target );
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ public class Bee extends Mob {
|
|||
private static final HashSet<Class<?>> IMMUNITIES = new HashSet<Class<?>>();
|
||||
static {
|
||||
IMMUNITIES.add( Poison.class );
|
||||
IMMUNITIES.add( Amok.class );
|
||||
IMMUNITIES.add( Amok.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -172,7 +172,7 @@ public class DM300 extends Mob {
|
|||
private static final HashSet<Class<?>> IMMUNITIES = new HashSet<Class<?>>();
|
||||
static {
|
||||
IMMUNITIES.add( ToxicGas.class );
|
||||
IMMUNITIES.add( Terror.class );
|
||||
IMMUNITIES.add( Terror.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -82,13 +82,13 @@ public class Elemental extends Mob {
|
|||
sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
|
||||
}
|
||||
} else if (buff instanceof Frost || buff instanceof Chill) {
|
||||
if (Level.water[this.pos])
|
||||
damage( Random.NormalIntRange( HT / 2, HT ), buff );
|
||||
else
|
||||
damage( Random.NormalIntRange( 1, HT * 2 / 3 ), buff );
|
||||
if (Level.water[this.pos])
|
||||
damage( Random.NormalIntRange( HT / 2, HT ), buff );
|
||||
else
|
||||
damage( Random.NormalIntRange( 1, HT * 2 / 3 ), buff );
|
||||
} else {
|
||||
super.add( buff );
|
||||
}
|
||||
super.add( buff );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -63,13 +63,13 @@ public class Goo extends Mob {
|
|||
@Override
|
||||
public int damageRoll() {
|
||||
if (pumpedUp > 0) {
|
||||
pumpedUp = 0;
|
||||
for (int i = 0; i < Level.NEIGHBOURS9DIST2.length; i++) {
|
||||
int j = pos + Level.NEIGHBOURS9DIST2[i];
|
||||
if (Level.insideMap(j) && Level.passable[j])
|
||||
CellEmitter.get(j).burst(ElmoParticle.FACTORY, 10);
|
||||
}
|
||||
Sample.INSTANCE.play( Assets.SND_BURNING );
|
||||
pumpedUp = 0;
|
||||
for (int i = 0; i < Level.NEIGHBOURS9DIST2.length; i++) {
|
||||
int j = pos + Level.NEIGHBOURS9DIST2[i];
|
||||
if (Level.insideMap(j) && Level.passable[j])
|
||||
CellEmitter.get(j).burst(ElmoParticle.FACTORY, 10);
|
||||
}
|
||||
Sample.INSTANCE.play( Assets.SND_BURNING );
|
||||
return Random.NormalIntRange( 5, 30 );
|
||||
} else {
|
||||
return Random.NormalIntRange( 2, 12 );
|
||||
|
@ -118,35 +118,35 @@ public class Goo extends Mob {
|
|||
|
||||
@Override
|
||||
protected boolean doAttack( Char enemy ) {
|
||||
if (pumpedUp == 1) {
|
||||
((GooSprite)sprite).pumpUp();
|
||||
for (int i = 0; i < Level.NEIGHBOURS9DIST2.length; i++) {
|
||||
int j = pos + Level.NEIGHBOURS9DIST2[i];
|
||||
if (Level.insideMap(j) && Level.passable[j])
|
||||
GameScene.add(Blob.seed(j, 2, GooWarn.class));
|
||||
}
|
||||
pumpedUp++;
|
||||
if (pumpedUp == 1) {
|
||||
((GooSprite)sprite).pumpUp();
|
||||
for (int i = 0; i < Level.NEIGHBOURS9DIST2.length; i++) {
|
||||
int j = pos + Level.NEIGHBOURS9DIST2[i];
|
||||
if (Level.insideMap(j) && Level.passable[j])
|
||||
GameScene.add(Blob.seed(j, 2, GooWarn.class));
|
||||
}
|
||||
pumpedUp++;
|
||||
|
||||
spend( attackDelay() );
|
||||
spend( attackDelay() );
|
||||
|
||||
return true;
|
||||
} else if (pumpedUp >= 2 || Random.Int( 3 ) > 0) {
|
||||
return true;
|
||||
} else if (pumpedUp >= 2 || Random.Int( 3 ) > 0) {
|
||||
|
||||
boolean visible = Dungeon.visible[pos];
|
||||
boolean visible = Dungeon.visible[pos];
|
||||
|
||||
if (visible) {
|
||||
if (pumpedUp >= 2) {
|
||||
((GooSprite) sprite).pumpAttack();
|
||||
}
|
||||
else
|
||||
sprite.attack( enemy.pos );
|
||||
} else {
|
||||
attack( enemy );
|
||||
}
|
||||
if (visible) {
|
||||
if (pumpedUp >= 2) {
|
||||
((GooSprite) sprite).pumpAttack();
|
||||
}
|
||||
else
|
||||
sprite.attack( enemy.pos );
|
||||
} else {
|
||||
attack( enemy );
|
||||
}
|
||||
|
||||
spend( attackDelay() );
|
||||
spend( attackDelay() );
|
||||
|
||||
return !visible;
|
||||
return !visible;
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -154,18 +154,18 @@ public class Goo extends Mob {
|
|||
|
||||
((GooSprite)sprite).pumpUp();
|
||||
|
||||
for (int i=0; i < Level.NEIGHBOURS9.length; i++) {
|
||||
int j = pos + Level.NEIGHBOURS9[i];
|
||||
GameScene.add( Blob.seed( j , 2, GooWarn.class ));
|
||||
for (int i=0; i < Level.NEIGHBOURS9.length; i++) {
|
||||
int j = pos + Level.NEIGHBOURS9[i];
|
||||
GameScene.add( Blob.seed( j , 2, GooWarn.class ));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (Dungeon.visible[pos]) {
|
||||
sprite.showStatus( CharSprite.NEGATIVE, "!!!" );
|
||||
GLog.n( "Goo is pumping itself up!" );
|
||||
}
|
||||
|
||||
spend( attackDelay() );
|
||||
spend( attackDelay() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -216,28 +216,28 @@ public class Goo extends Mob {
|
|||
return
|
||||
"Little is known about The Goo. It's quite possible that it is not even a creature, but rather a " +
|
||||
"conglomerate of vile substances from the sewers that somehow gained basic intelligence. " +
|
||||
"Regardless, dark magic is certainly what has allowed Goo to exist.\n\n" +
|
||||
"Its gelatinous nature has let it absorb lots of dark energy, you feel a chill just from being near. " +
|
||||
"If goo is able to attack with this energy you won't live for long.";
|
||||
"Regardless, dark magic is certainly what has allowed Goo to exist.\n\n" +
|
||||
"Its gelatinous nature has let it absorb lots of dark energy, you feel a chill just from being near. " +
|
||||
"If goo is able to attack with this energy you won't live for long.";
|
||||
}
|
||||
|
||||
private final String PUMPEDUP = "pumpedup";
|
||||
private final String PUMPEDUP = "pumpedup";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
|
||||
super.storeInBundle( bundle );
|
||||
super.storeInBundle( bundle );
|
||||
|
||||
bundle.put( PUMPEDUP , pumpedUp );
|
||||
}
|
||||
bundle.put( PUMPEDUP , pumpedUp );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
|
||||
super.restoreFromBundle( bundle );
|
||||
super.restoreFromBundle( bundle );
|
||||
|
||||
pumpedUp = bundle.getInt( PUMPEDUP );
|
||||
}
|
||||
pumpedUp = bundle.getInt( PUMPEDUP );
|
||||
}
|
||||
|
||||
private static final HashSet<Class<?>> RESISTANCES = new HashSet<Class<?>>();
|
||||
static {
|
||||
|
|
|
@ -59,12 +59,12 @@ public abstract class Mob extends Char {
|
|||
protected static final String TXT_RAGE = "#$%^";
|
||||
protected static final String TXT_EXP = "%+dEXP";
|
||||
|
||||
public AiState SLEEPING = new Sleeping();
|
||||
public AiState HUNTING = new Hunting();
|
||||
public AiState WANDERING = new Wandering();
|
||||
public AiState FLEEING = new Fleeing();
|
||||
public AiState PASSIVE = new Passive();
|
||||
public AiState state = SLEEPING;
|
||||
public AiState SLEEPING = new Sleeping();
|
||||
public AiState HUNTING = new Hunting();
|
||||
public AiState WANDERING = new Wandering();
|
||||
public AiState FLEEING = new Fleeing();
|
||||
public AiState PASSIVE = new Passive();
|
||||
public AiState state = SLEEPING;
|
||||
|
||||
public Class<? extends CharSprite> spriteClass;
|
||||
|
||||
|
@ -85,7 +85,7 @@ public abstract class Mob extends Char {
|
|||
public boolean ally = false;
|
||||
|
||||
private static final String STATE = "state";
|
||||
private static final String SEEN = "seen";
|
||||
private static final String SEEN = "seen";
|
||||
private static final String TARGET = "target";
|
||||
|
||||
@Override
|
||||
|
@ -93,19 +93,19 @@ public abstract class Mob extends Char {
|
|||
|
||||
super.storeInBundle( bundle );
|
||||
|
||||
if (state == SLEEPING) {
|
||||
bundle.put( STATE, Sleeping.TAG );
|
||||
} else if (state == WANDERING) {
|
||||
bundle.put( STATE, Wandering.TAG );
|
||||
} else if (state == HUNTING) {
|
||||
bundle.put( STATE, Hunting.TAG );
|
||||
} else if (state == FLEEING) {
|
||||
bundle.put( STATE, Fleeing.TAG );
|
||||
} else if (state == PASSIVE) {
|
||||
bundle.put( STATE, Passive.TAG );
|
||||
}
|
||||
if (state == SLEEPING) {
|
||||
bundle.put( STATE, Sleeping.TAG );
|
||||
} else if (state == WANDERING) {
|
||||
bundle.put( STATE, Wandering.TAG );
|
||||
} else if (state == HUNTING) {
|
||||
bundle.put( STATE, Hunting.TAG );
|
||||
} else if (state == FLEEING) {
|
||||
bundle.put( STATE, Fleeing.TAG );
|
||||
} else if (state == PASSIVE) {
|
||||
bundle.put( STATE, Passive.TAG );
|
||||
}
|
||||
bundle.put( SEEN, enemySeen );
|
||||
bundle.put( TARGET, target );
|
||||
bundle.put( TARGET, target );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -113,23 +113,23 @@ public abstract class Mob extends Char {
|
|||
|
||||
super.restoreFromBundle( bundle );
|
||||
|
||||
String state = bundle.getString( STATE );
|
||||
if (state.equals( Sleeping.TAG )) {
|
||||
this.state = SLEEPING;
|
||||
} else if (state.equals( Wandering.TAG )) {
|
||||
this.state = WANDERING;
|
||||
} else if (state.equals( Hunting.TAG )) {
|
||||
this.state = HUNTING;
|
||||
} else if (state.equals( Fleeing.TAG )) {
|
||||
this.state = FLEEING;
|
||||
} else if (state.equals( Passive.TAG )) {
|
||||
this.state = PASSIVE;
|
||||
}
|
||||
String state = bundle.getString( STATE );
|
||||
if (state.equals( Sleeping.TAG )) {
|
||||
this.state = SLEEPING;
|
||||
} else if (state.equals( Wandering.TAG )) {
|
||||
this.state = WANDERING;
|
||||
} else if (state.equals( Hunting.TAG )) {
|
||||
this.state = HUNTING;
|
||||
} else if (state.equals( Fleeing.TAG )) {
|
||||
this.state = FLEEING;
|
||||
} else if (state.equals( Passive.TAG )) {
|
||||
this.state = PASSIVE;
|
||||
}
|
||||
|
||||
enemySeen = bundle.getBoolean( SEEN );
|
||||
|
||||
target = bundle.getInt( TARGET );
|
||||
}
|
||||
target = bundle.getInt( TARGET );
|
||||
}
|
||||
|
||||
public CharSprite sprite() {
|
||||
CharSprite sprite = null;
|
||||
|
@ -160,7 +160,7 @@ public abstract class Mob extends Char {
|
|||
|
||||
boolean enemyInFOV = enemy != null && enemy.isAlive() && Level.fieldOfView[enemy.pos] && enemy.invisible <= 0;
|
||||
|
||||
return state.act( enemyInFOV, justAlerted );
|
||||
return state.act( enemyInFOV, justAlerted );
|
||||
}
|
||||
|
||||
protected Char chooseEnemy() {
|
||||
|
@ -247,7 +247,7 @@ public abstract class Mob extends Char {
|
|||
state = FLEEING;
|
||||
} else if (buff instanceof Sleep) {
|
||||
state = SLEEPING;
|
||||
this.sprite().showSleep();
|
||||
this.sprite().showSleep();
|
||||
postpone( Sleep.SWS );
|
||||
}
|
||||
}
|
||||
|
@ -294,14 +294,14 @@ public abstract class Mob extends Char {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSpriteState() {
|
||||
super.updateSpriteState();
|
||||
if (Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class) != null)
|
||||
sprite.add( CharSprite.State.PARALYSED );
|
||||
}
|
||||
@Override
|
||||
public void updateSpriteState() {
|
||||
super.updateSpriteState();
|
||||
if (Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class) != null)
|
||||
sprite.add( CharSprite.State.PARALYSED );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void move( int step ) {
|
||||
super.move( step );
|
||||
|
||||
|
@ -337,18 +337,18 @@ public abstract class Mob extends Char {
|
|||
|
||||
@Override
|
||||
public int defenseSkill( Char enemy ) {
|
||||
if (enemySeen && !paralysed) {
|
||||
int defenseSkill = this.defenseSkill;
|
||||
int penalty = 0;
|
||||
for (Buff buff : enemy.buffs(RingOfAccuracy.Accuracy.class)) {
|
||||
penalty += ((RingOfAccuracy.Accuracy) buff).level;
|
||||
}
|
||||
if (penalty != 0 && enemy == Dungeon.hero)
|
||||
defenseSkill *= Math.pow(0.75, penalty);
|
||||
return defenseSkill;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
if (enemySeen && !paralysed) {
|
||||
int defenseSkill = this.defenseSkill;
|
||||
int penalty = 0;
|
||||
for (Buff buff : enemy.buffs(RingOfAccuracy.Accuracy.class)) {
|
||||
penalty += ((RingOfAccuracy.Accuracy) buff).level;
|
||||
}
|
||||
if (penalty != 0 && enemy == Dungeon.hero)
|
||||
defenseSkill *= Math.pow(0.75, penalty);
|
||||
return defenseSkill;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -382,9 +382,9 @@ public abstract class Mob extends Char {
|
|||
|
||||
Terror.recover( this );
|
||||
|
||||
if (state == SLEEPING) {
|
||||
state = WANDERING;
|
||||
}
|
||||
if (state == SLEEPING) {
|
||||
state = WANDERING;
|
||||
}
|
||||
alerted = true;
|
||||
|
||||
super.damage( dmg, src );
|
||||
|
@ -425,18 +425,18 @@ public abstract class Mob extends Char {
|
|||
|
||||
super.die( cause );
|
||||
|
||||
float lootChance = this.lootChance;
|
||||
int bonus = 0;
|
||||
for (Buff buff : Dungeon.hero.buffs(RingOfWealth.Wealth.class)) {
|
||||
bonus += ((RingOfWealth.Wealth) buff).level;
|
||||
}
|
||||
float lootChance = this.lootChance;
|
||||
int bonus = 0;
|
||||
for (Buff buff : Dungeon.hero.buffs(RingOfWealth.Wealth.class)) {
|
||||
bonus += ((RingOfWealth.Wealth) buff).level;
|
||||
}
|
||||
|
||||
lootChance *= Math.pow(1.1, bonus);
|
||||
lootChance *= Math.pow(1.1, bonus);
|
||||
|
||||
if (Random.Float() < lootChance && Dungeon.hero.lvl <= maxLvl + 2) {
|
||||
Item loot = createLoot();
|
||||
if (loot != null)
|
||||
Dungeon.level.drop( loot , pos ).sprite.drop();
|
||||
Item loot = createLoot();
|
||||
if (loot != null)
|
||||
Dungeon.level.drop( loot , pos ).sprite.drop();
|
||||
}
|
||||
|
||||
if (Dungeon.hero.isAlive() && !Dungeon.visible[pos]) {
|
||||
|
@ -449,21 +449,21 @@ public abstract class Mob extends Char {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Item createLoot() {
|
||||
Item item;
|
||||
if (loot instanceof Generator.Category) {
|
||||
Item item;
|
||||
if (loot instanceof Generator.Category) {
|
||||
|
||||
item = Generator.random( (Generator.Category)loot );
|
||||
item = Generator.random( (Generator.Category)loot );
|
||||
|
||||
} else if (loot instanceof Class<?>) {
|
||||
} else if (loot instanceof Class<?>) {
|
||||
|
||||
item = Generator.random( (Class<? extends Item>)loot );
|
||||
item = Generator.random( (Class<? extends Item>)loot );
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
item = (Item)loot;
|
||||
item = (Item)loot;
|
||||
|
||||
}
|
||||
return item;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
public boolean reset() {
|
||||
|
@ -497,177 +497,177 @@ public abstract class Mob extends Char {
|
|||
return enemySeen && (target == Dungeon.hero.pos);
|
||||
}
|
||||
|
||||
public interface AiState {
|
||||
public boolean act( boolean enemyInFOV, boolean justAlerted );
|
||||
public String status();
|
||||
}
|
||||
public interface AiState {
|
||||
public boolean act( boolean enemyInFOV, boolean justAlerted );
|
||||
public String status();
|
||||
}
|
||||
|
||||
private class Sleeping implements AiState {
|
||||
private class Sleeping implements AiState {
|
||||
|
||||
public static final String TAG = "SLEEPING";
|
||||
public static final String TAG = "SLEEPING";
|
||||
|
||||
@Override
|
||||
public boolean act( boolean enemyInFOV, boolean justAlerted ) {
|
||||
if (enemyInFOV && Random.Int( distance( enemy ) + enemy.stealth() + (enemy.flying ? 2 : 0) ) == 0) {
|
||||
@Override
|
||||
public boolean act( boolean enemyInFOV, boolean justAlerted ) {
|
||||
if (enemyInFOV && Random.Int( distance( enemy ) + enemy.stealth() + (enemy.flying ? 2 : 0) ) == 0) {
|
||||
|
||||
enemySeen = true;
|
||||
enemySeen = true;
|
||||
|
||||
notice();
|
||||
state = HUNTING;
|
||||
target = enemy.pos;
|
||||
notice();
|
||||
state = HUNTING;
|
||||
target = enemy.pos;
|
||||
|
||||
if (Dungeon.isChallenged( Challenges.SWARM_INTELLIGENCE )) {
|
||||
for (Mob mob : Dungeon.level.mobs) {
|
||||
if (mob != Mob.this) {
|
||||
mob.beckon( target );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Dungeon.isChallenged( Challenges.SWARM_INTELLIGENCE )) {
|
||||
for (Mob mob : Dungeon.level.mobs) {
|
||||
if (mob != Mob.this) {
|
||||
mob.beckon( target );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
spend( TIME_TO_WAKE_UP );
|
||||
spend( TIME_TO_WAKE_UP );
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
enemySeen = false;
|
||||
enemySeen = false;
|
||||
|
||||
spend( TICK );
|
||||
spend( TICK );
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String status() {
|
||||
return Utils.format( "This %s is sleeping", name );
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String status() {
|
||||
return Utils.format( "This %s is sleeping", name );
|
||||
}
|
||||
}
|
||||
|
||||
private class Wandering implements AiState {
|
||||
private class Wandering implements AiState {
|
||||
|
||||
public static final String TAG = "WANDERING";
|
||||
public static final String TAG = "WANDERING";
|
||||
|
||||
@Override
|
||||
public boolean act( boolean enemyInFOV, boolean justAlerted ) {
|
||||
if (enemyInFOV && (justAlerted || Random.Int( distance( enemy ) / 2 + enemy.stealth() ) == 0)) {
|
||||
@Override
|
||||
public boolean act( boolean enemyInFOV, boolean justAlerted ) {
|
||||
if (enemyInFOV && (justAlerted || Random.Int( distance( enemy ) / 2 + enemy.stealth() ) == 0)) {
|
||||
|
||||
enemySeen = true;
|
||||
enemySeen = true;
|
||||
|
||||
notice();
|
||||
state = HUNTING;
|
||||
target = enemy.pos;
|
||||
notice();
|
||||
state = HUNTING;
|
||||
target = enemy.pos;
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
enemySeen = false;
|
||||
enemySeen = false;
|
||||
|
||||
int oldPos = pos;
|
||||
if (target != -1 && getCloser( target )) {
|
||||
spend( 1 / speed() );
|
||||
return moveSprite( oldPos, pos );
|
||||
} else {
|
||||
target = Dungeon.level.randomDestination();
|
||||
spend( TICK );
|
||||
}
|
||||
int oldPos = pos;
|
||||
if (target != -1 && getCloser( target )) {
|
||||
spend( 1 / speed() );
|
||||
return moveSprite( oldPos, pos );
|
||||
} else {
|
||||
target = Dungeon.level.randomDestination();
|
||||
spend( TICK );
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String status() {
|
||||
return Utils.format( "This %s is wandering", name );
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String status() {
|
||||
return Utils.format( "This %s is wandering", name );
|
||||
}
|
||||
}
|
||||
|
||||
private class Hunting implements AiState {
|
||||
private class Hunting implements AiState {
|
||||
|
||||
public static final String TAG = "HUNTING";
|
||||
public static final String TAG = "HUNTING";
|
||||
|
||||
@Override
|
||||
public boolean act( boolean enemyInFOV, boolean justAlerted ) {
|
||||
enemySeen = enemyInFOV;
|
||||
if (enemyInFOV && !isCharmedBy( enemy ) && canAttack( enemy )) {
|
||||
@Override
|
||||
public boolean act( boolean enemyInFOV, boolean justAlerted ) {
|
||||
enemySeen = enemyInFOV;
|
||||
if (enemyInFOV && !isCharmedBy( enemy ) && canAttack( enemy )) {
|
||||
|
||||
return doAttack( enemy );
|
||||
return doAttack( enemy );
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
if (enemyInFOV) {
|
||||
target = enemy.pos;
|
||||
}
|
||||
if (enemyInFOV) {
|
||||
target = enemy.pos;
|
||||
}
|
||||
|
||||
int oldPos = pos;
|
||||
if (target != -1 && getCloser( target )) {
|
||||
int oldPos = pos;
|
||||
if (target != -1 && getCloser( target )) {
|
||||
|
||||
spend( 1 / speed() );
|
||||
return moveSprite( oldPos, pos );
|
||||
spend( 1 / speed() );
|
||||
return moveSprite( oldPos, pos );
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
spend( TICK );
|
||||
state = WANDERING;
|
||||
target = Dungeon.level.randomDestination();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
spend( TICK );
|
||||
state = WANDERING;
|
||||
target = Dungeon.level.randomDestination();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String status() {
|
||||
return Utils.format( "This %s is hunting", name );
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String status() {
|
||||
return Utils.format( "This %s is hunting", name );
|
||||
}
|
||||
}
|
||||
|
||||
protected class Fleeing implements AiState {
|
||||
protected class Fleeing implements AiState {
|
||||
|
||||
public static final String TAG = "FLEEING";
|
||||
public static final String TAG = "FLEEING";
|
||||
|
||||
@Override
|
||||
public boolean act( boolean enemyInFOV, boolean justAlerted ) {
|
||||
enemySeen = enemyInFOV;
|
||||
if (enemyInFOV) {
|
||||
target = enemy.pos;
|
||||
}
|
||||
@Override
|
||||
public boolean act( boolean enemyInFOV, boolean justAlerted ) {
|
||||
enemySeen = enemyInFOV;
|
||||
if (enemyInFOV) {
|
||||
target = enemy.pos;
|
||||
}
|
||||
|
||||
int oldPos = pos;
|
||||
if (target != -1 && getFurther( target )) {
|
||||
int oldPos = pos;
|
||||
if (target != -1 && getFurther( target )) {
|
||||
|
||||
spend( 1 / speed() );
|
||||
return moveSprite( oldPos, pos );
|
||||
spend( 1 / speed() );
|
||||
return moveSprite( oldPos, pos );
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
spend( TICK );
|
||||
nowhereToRun();
|
||||
spend( TICK );
|
||||
nowhereToRun();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected void nowhereToRun() {
|
||||
}
|
||||
protected void nowhereToRun() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String status() {
|
||||
return Utils.format( "This %s is fleeing", name );
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String status() {
|
||||
return Utils.format( "This %s is fleeing", name );
|
||||
}
|
||||
}
|
||||
|
||||
private class Passive implements AiState {
|
||||
private class Passive implements AiState {
|
||||
|
||||
public static final String TAG = "PASSIVE";
|
||||
public static final String TAG = "PASSIVE";
|
||||
|
||||
@Override
|
||||
public boolean act( boolean enemyInFOV, boolean justAlerted ) {
|
||||
enemySeen = false;
|
||||
spend( TICK );
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean act( boolean enemyInFOV, boolean justAlerted ) {
|
||||
enemySeen = false;
|
||||
spend( TICK );
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String status() {
|
||||
return Utils.format( "This %s is passive", name );
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String status() {
|
||||
return Utils.format( "This %s is passive", name );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,10 +92,10 @@ public class Scorpio extends Mob {
|
|||
|
||||
@Override
|
||||
protected Item createLoot() {
|
||||
//5/count+5 total chance of getting healing, failing the 2nd roll drops mystery meat instead.
|
||||
//5/count+5 total chance of getting healing, failing the 2nd roll drops mystery meat instead.
|
||||
if (Random.Int( 5 + Dungeon.limitedDrops.scorpioHP.count ) <= 4) {
|
||||
Dungeon.limitedDrops.scorpioHP.count++;
|
||||
return (Item)loot;
|
||||
Dungeon.limitedDrops.scorpioHP.count++;
|
||||
return (Item)loot;
|
||||
} else {
|
||||
return new MysteryMeat();
|
||||
}
|
||||
|
|
|
@ -47,8 +47,8 @@ public class Skeleton extends Mob {
|
|||
EXP = 5;
|
||||
maxLvl = 10;
|
||||
|
||||
loot = Generator.Category.WEAPON;
|
||||
lootChance = 0.2f;
|
||||
loot = Generator.Category.WEAPON;
|
||||
lootChance = 0.2f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -85,15 +85,15 @@ public class Skeleton extends Mob {
|
|||
|
||||
@Override
|
||||
protected Item createLoot() {
|
||||
Item loot = Generator.random( Generator.Category.WEAPON );
|
||||
for (int i=0; i < 2; i++) {
|
||||
Item l = Generator.random( Generator.Category.WEAPON );
|
||||
if (l.level < loot.level) {
|
||||
loot = l;
|
||||
}
|
||||
}
|
||||
return loot;
|
||||
}
|
||||
Item loot = Generator.random( Generator.Category.WEAPON );
|
||||
for (int i=0; i < 2; i++) {
|
||||
Item l = Generator.random( Generator.Category.WEAPON );
|
||||
if (l.level < loot.level) {
|
||||
loot = l;
|
||||
}
|
||||
}
|
||||
return loot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int attackSkill( Char target ) {
|
||||
|
|
|
@ -33,103 +33,103 @@ import com.watabou.utils.Random;
|
|||
|
||||
public class Spinner extends Mob {
|
||||
|
||||
{
|
||||
name = "cave spinner";
|
||||
spriteClass = SpinnerSprite.class;
|
||||
{
|
||||
name = "cave spinner";
|
||||
spriteClass = SpinnerSprite.class;
|
||||
|
||||
HP = HT = 50;
|
||||
defenseSkill = 14;
|
||||
HP = HT = 50;
|
||||
defenseSkill = 14;
|
||||
|
||||
EXP = 9;
|
||||
maxLvl = 16;
|
||||
EXP = 9;
|
||||
maxLvl = 16;
|
||||
|
||||
loot = new MysteryMeat();
|
||||
lootChance = 0.125f;
|
||||
loot = new MysteryMeat();
|
||||
lootChance = 0.125f;
|
||||
|
||||
FLEEING = new Fleeing();
|
||||
}
|
||||
FLEEING = new Fleeing();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageRoll() {
|
||||
return Random.NormalIntRange(12, 16);
|
||||
}
|
||||
@Override
|
||||
public int damageRoll() {
|
||||
return Random.NormalIntRange(12, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int attackSkill(Char target) {
|
||||
return 20;
|
||||
}
|
||||
@Override
|
||||
public int attackSkill(Char target) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int dr() {
|
||||
return 6;
|
||||
}
|
||||
@Override
|
||||
public int dr() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean act() {
|
||||
boolean result = super.act();
|
||||
@Override
|
||||
protected boolean act() {
|
||||
boolean result = super.act();
|
||||
|
||||
if (state == FLEEING && buff( Terror.class ) == null &&
|
||||
enemy != null && enemySeen && enemy.buff( Poison.class ) == null) {
|
||||
state = HUNTING;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
if (state == FLEEING && buff( Terror.class ) == null &&
|
||||
enemy != null && enemySeen && enemy.buff( Poison.class ) == null) {
|
||||
state = HUNTING;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int attackProc(Char enemy, int damage) {
|
||||
if (Random.Int(2) == 0) {
|
||||
Buff.affect(enemy, Poison.class).set(Random.Int(7, 9) * Poison.durationFactor(enemy));
|
||||
state = FLEEING;
|
||||
}
|
||||
@Override
|
||||
public int attackProc(Char enemy, int damage) {
|
||||
if (Random.Int(2) == 0) {
|
||||
Buff.affect(enemy, Poison.class).set(Random.Int(7, 9) * Poison.durationFactor(enemy));
|
||||
state = FLEEING;
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void move(int step) {
|
||||
if (state == FLEEING) {
|
||||
GameScene.add(Blob.seed(pos, Random.Int(5, 7), Web.class));
|
||||
}
|
||||
super.move(step);
|
||||
}
|
||||
@Override
|
||||
public void move(int step) {
|
||||
if (state == FLEEING) {
|
||||
GameScene.add(Blob.seed(pos, Random.Int(5, 7), Web.class));
|
||||
}
|
||||
super.move(step);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return
|
||||
"These greenish furry cave spiders try to avoid direct combat, preferring to wait in the distance " +
|
||||
"while their victim, entangled in the spinner's excreted cobweb, slowly dies from their poisonous bite.";
|
||||
}
|
||||
@Override
|
||||
public String description() {
|
||||
return
|
||||
"These greenish furry cave spiders try to avoid direct combat, preferring to wait in the distance " +
|
||||
"while their victim, entangled in the spinner's excreted cobweb, slowly dies from their poisonous bite.";
|
||||
}
|
||||
|
||||
private static final HashSet<Class<?>> RESISTANCES = new HashSet<Class<?>>();
|
||||
private static final HashSet<Class<?>> RESISTANCES = new HashSet<Class<?>>();
|
||||
|
||||
static {
|
||||
RESISTANCES.add(Poison.class);
|
||||
}
|
||||
static {
|
||||
RESISTANCES.add(Poison.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<Class<?>> resistances() {
|
||||
return RESISTANCES;
|
||||
}
|
||||
@Override
|
||||
public HashSet<Class<?>> resistances() {
|
||||
return RESISTANCES;
|
||||
}
|
||||
|
||||
private static final HashSet<Class<?>> IMMUNITIES = new HashSet<Class<?>>();
|
||||
private static final HashSet<Class<?>> IMMUNITIES = new HashSet<Class<?>>();
|
||||
|
||||
static {
|
||||
IMMUNITIES.add(Roots.class);
|
||||
}
|
||||
static {
|
||||
IMMUNITIES.add(Roots.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<Class<?>> immunities() {
|
||||
return IMMUNITIES;
|
||||
}
|
||||
@Override
|
||||
public HashSet<Class<?>> immunities() {
|
||||
return IMMUNITIES;
|
||||
}
|
||||
|
||||
private class Fleeing extends Mob.Fleeing {
|
||||
@Override
|
||||
protected void nowhereToRun() {
|
||||
if (buff(Terror.class) == null) {
|
||||
state = HUNTING;
|
||||
} else {
|
||||
super.nowhereToRun();
|
||||
}
|
||||
}
|
||||
}
|
||||
private class Fleeing extends Mob.Fleeing {
|
||||
@Override
|
||||
protected void nowhereToRun() {
|
||||
if (buff(Terror.class) == null) {
|
||||
state = HUNTING;
|
||||
} else {
|
||||
super.nowhereToRun();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,8 +50,8 @@ public class Swarm extends Mob {
|
|||
|
||||
flying = true;
|
||||
|
||||
loot = new PotionOfHealing();
|
||||
lootChance = 0.2f; //by default, see die()
|
||||
loot = new PotionOfHealing();
|
||||
lootChance = 0.2f; //by default, see die()
|
||||
}
|
||||
|
||||
private static final float SPLIT_DELAY = 1f;
|
||||
|
@ -139,16 +139,16 @@ public class Swarm extends Mob {
|
|||
|
||||
@Override
|
||||
public void die( Object cause ){
|
||||
//sets drop chance
|
||||
lootChance = 1f/((5 + Dungeon.limitedDrops.swarmHP.count ) * (generation+1) );
|
||||
super.die( cause );
|
||||
}
|
||||
//sets drop chance
|
||||
lootChance = 1f/((5 + Dungeon.limitedDrops.swarmHP.count ) * (generation+1) );
|
||||
super.die( cause );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Item createLoot(){
|
||||
Dungeon.limitedDrops.swarmHP.count++;
|
||||
return super.createLoot();
|
||||
}
|
||||
@Override
|
||||
protected Item createLoot(){
|
||||
Dungeon.limitedDrops.swarmHP.count++;
|
||||
return super.createLoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
|
|
|
@ -50,132 +50,132 @@ public class Thief extends Mob {
|
|||
maxLvl = 10;
|
||||
|
||||
loot = new MasterThievesArmband().identify();
|
||||
lootChance = 0.01f;
|
||||
lootChance = 0.01f;
|
||||
|
||||
FLEEING = new Fleeing();
|
||||
}
|
||||
FLEEING = new Fleeing();
|
||||
}
|
||||
|
||||
private static final String ITEM = "item";
|
||||
private static final String ITEM = "item";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( ITEM, item );
|
||||
}
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( ITEM, item );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
item = (Item)bundle.get( ITEM );
|
||||
}
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
item = (Item)bundle.get( ITEM );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageRoll() {
|
||||
return Random.NormalIntRange( 1, 7 );
|
||||
}
|
||||
@Override
|
||||
public int damageRoll() {
|
||||
return Random.NormalIntRange( 1, 7 );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float attackDelay() {
|
||||
return 0.5f;
|
||||
}
|
||||
@Override
|
||||
protected float attackDelay() {
|
||||
return 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die( Object cause ) {
|
||||
@Override
|
||||
public void die( Object cause ) {
|
||||
|
||||
super.die( cause );
|
||||
super.die( cause );
|
||||
|
||||
if (item != null) {
|
||||
Dungeon.level.drop( item, pos ).sprite.drop();
|
||||
//updates position
|
||||
if (item instanceof Honeypot.ShatteredPot) ((Honeypot.ShatteredPot)item).setHolder( this );
|
||||
}
|
||||
}
|
||||
if (item != null) {
|
||||
Dungeon.level.drop( item, pos ).sprite.drop();
|
||||
//updates position
|
||||
if (item instanceof Honeypot.ShatteredPot) ((Honeypot.ShatteredPot)item).setHolder( this );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Item createLoot(){
|
||||
if (!Dungeon.limitedDrops.armband.dropped()) {
|
||||
Dungeon.limitedDrops.armband.drop();
|
||||
return super.createLoot();
|
||||
} else
|
||||
return new Gold(Random.NormalIntRange(100, 250));
|
||||
}
|
||||
@Override
|
||||
protected Item createLoot(){
|
||||
if (!Dungeon.limitedDrops.armband.dropped()) {
|
||||
Dungeon.limitedDrops.armband.drop();
|
||||
return super.createLoot();
|
||||
} else
|
||||
return new Gold(Random.NormalIntRange(100, 250));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int attackSkill( Char target ) {
|
||||
return 12;
|
||||
}
|
||||
@Override
|
||||
public int attackSkill( Char target ) {
|
||||
return 12;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int dr() {
|
||||
return 3;
|
||||
}
|
||||
@Override
|
||||
public int dr() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int attackProc( Char enemy, int damage ) {
|
||||
if (item == null && enemy instanceof Hero && steal( (Hero)enemy )) {
|
||||
state = FLEEING;
|
||||
}
|
||||
@Override
|
||||
public int attackProc( Char enemy, int damage ) {
|
||||
if (item == null && enemy instanceof Hero && steal( (Hero)enemy )) {
|
||||
state = FLEEING;
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int defenseProc(Char enemy, int damage) {
|
||||
if (state == FLEEING) {
|
||||
Dungeon.level.drop( new Gold(), pos ).sprite.drop();
|
||||
}
|
||||
@Override
|
||||
public int defenseProc(Char enemy, int damage) {
|
||||
if (state == FLEEING) {
|
||||
Dungeon.level.drop( new Gold(), pos ).sprite.drop();
|
||||
}
|
||||
|
||||
return super.defenseProc(enemy, damage);
|
||||
}
|
||||
return super.defenseProc(enemy, damage);
|
||||
}
|
||||
|
||||
protected boolean steal( Hero hero ) {
|
||||
protected boolean steal( Hero hero ) {
|
||||
|
||||
Item item = hero.belongings.randomUnequipped();
|
||||
if (item != null) {
|
||||
Item item = hero.belongings.randomUnequipped();
|
||||
if (item != null) {
|
||||
|
||||
GLog.w( TXT_STOLE, this.name, item.name() );
|
||||
GLog.w( TXT_STOLE, this.name, item.name() );
|
||||
|
||||
|
||||
|
||||
if (item instanceof Honeypot){
|
||||
this.item = ((Honeypot)item).shatter(this, this.pos);
|
||||
item.detach( hero.belongings.backpack );
|
||||
} else {
|
||||
this.item = item;
|
||||
if ( item instanceof Honeypot.ShatteredPot)
|
||||
((Honeypot.ShatteredPot)item).setHolder(this);
|
||||
item.detachAll( hero.belongings.backpack );
|
||||
}
|
||||
if (item instanceof Honeypot){
|
||||
this.item = ((Honeypot)item).shatter(this, this.pos);
|
||||
item.detach( hero.belongings.backpack );
|
||||
} else {
|
||||
this.item = item;
|
||||
if ( item instanceof Honeypot.ShatteredPot)
|
||||
((Honeypot.ShatteredPot)item).setHolder(this);
|
||||
item.detachAll( hero.belongings.backpack );
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
String desc =
|
||||
"Deeper levels of the dungeon have always been a hiding place for all kinds of criminals. " +
|
||||
"Not all of them could keep a clear mind during their extended periods so far from daylight. Long ago, " +
|
||||
"these crazy thieves and bandits have forgotten who they are and why they steal.";
|
||||
@Override
|
||||
public String description() {
|
||||
String desc =
|
||||
"Deeper levels of the dungeon have always been a hiding place for all kinds of criminals. " +
|
||||
"Not all of them could keep a clear mind during their extended periods so far from daylight. Long ago, " +
|
||||
"these crazy thieves and bandits have forgotten who they are and why they steal.";
|
||||
|
||||
if (item != null) {
|
||||
desc += String.format( TXT_CARRIES, Utils.capitalize( this.name ), item.name() );
|
||||
}
|
||||
if (item != null) {
|
||||
desc += String.format( TXT_CARRIES, Utils.capitalize( this.name ), item.name() );
|
||||
}
|
||||
|
||||
return desc;
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
private class Fleeing extends Mob.Fleeing {
|
||||
@Override
|
||||
protected void nowhereToRun() {
|
||||
if (buff( Terror.class ) == null) {
|
||||
sprite.showStatus( CharSprite.NEGATIVE, TXT_RAGE );
|
||||
state = HUNTING;
|
||||
} else {
|
||||
super.nowhereToRun();
|
||||
}
|
||||
}
|
||||
}
|
||||
private class Fleeing extends Mob.Fleeing {
|
||||
@Override
|
||||
protected void nowhereToRun() {
|
||||
if (buff( Terror.class ) == null) {
|
||||
sprite.showStatus( CharSprite.NEGATIVE, TXT_RAGE );
|
||||
state = HUNTING;
|
||||
} else {
|
||||
super.nowhereToRun();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,22 +126,22 @@ public class Warlock extends Mob implements Callback {
|
|||
next();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item createLoot(){
|
||||
Item loot = super.createLoot();
|
||||
@Override
|
||||
public Item createLoot(){
|
||||
Item loot = super.createLoot();
|
||||
|
||||
if (loot instanceof PotionOfHealing){
|
||||
if (loot instanceof PotionOfHealing){
|
||||
|
||||
//count/10 chance of not dropping potion
|
||||
if (Random.Int(10)-Dungeon.limitedDrops.warlockHP.count < 0){
|
||||
return null;
|
||||
} else
|
||||
Dungeon.limitedDrops.warlockHP.count++;
|
||||
//count/10 chance of not dropping potion
|
||||
if (Random.Int(10)-Dungeon.limitedDrops.warlockHP.count < 0){
|
||||
return null;
|
||||
} else
|
||||
Dungeon.limitedDrops.warlockHP.count++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return loot;
|
||||
}
|
||||
return loot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
|
|
|
@ -133,11 +133,11 @@ public class Yog extends Mob {
|
|||
Actor.addDelayed( new Pushing( larva, pos, larva.pos ), -1 );
|
||||
}
|
||||
|
||||
for (Mob mob : Dungeon.level.mobs) {
|
||||
if (mob instanceof BurningFist || mob instanceof RottingFist || mob instanceof Larva) {
|
||||
mob.aggro( enemy );
|
||||
}
|
||||
}
|
||||
for (Mob mob : Dungeon.level.mobs) {
|
||||
if (mob instanceof BurningFist || mob instanceof RottingFist || mob instanceof Larva) {
|
||||
mob.aggro( enemy );
|
||||
}
|
||||
}
|
||||
|
||||
return super.defenseProc(enemy, damage);
|
||||
}
|
||||
|
@ -377,7 +377,7 @@ public class Yog extends Mob {
|
|||
IMMUNITIES.add( Sleep.class );
|
||||
IMMUNITIES.add( Terror.class );
|
||||
IMMUNITIES.add( Burning.class );
|
||||
IMMUNITIES.add( ScrollOfPsionicBlast.class );
|
||||
IMMUNITIES.add( ScrollOfPsionicBlast.class );
|
||||
IMMUNITIES.add( Vertigo.class );
|
||||
}
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ public class Blacksmith extends NPC {
|
|||
return "Select 2 different items, not the same item twice!";
|
||||
}
|
||||
|
||||
if (item1.getClass() != item2.getClass()) {
|
||||
if (item1.getClass() != item2.getClass()) {
|
||||
return "Select 2 items of the same type!";
|
||||
}
|
||||
|
||||
|
|
|
@ -77,37 +77,37 @@ public class Ghost extends NPC {
|
|||
}
|
||||
|
||||
private static final String TXT_RAT1 =
|
||||
"Hello %s... Once I was like you - strong and confident... " +
|
||||
"But I was slain by a foul beast... I can't leave this place... Not until I have my revenge... " +
|
||||
"Slay the _fetid rat_, that has taken my life...\n\n" +
|
||||
"It stalks this floor... Spreading filth everywhere... " +
|
||||
"_Beware its cloud of stink and corrosive bite, the acid dissolves in water..._ ";
|
||||
"Hello %s... Once I was like you - strong and confident... " +
|
||||
"But I was slain by a foul beast... I can't leave this place... Not until I have my revenge... " +
|
||||
"Slay the _fetid rat_, that has taken my life...\n\n" +
|
||||
"It stalks this floor... Spreading filth everywhere... " +
|
||||
"_Beware its cloud of stink and corrosive bite, the acid dissolves in water..._ ";
|
||||
|
||||
private static final String TXT_RAT2 =
|
||||
"Please... Help me... Slay the abomination...\n\n" +
|
||||
"_Fight it near water... Avoid the stench..._";
|
||||
private static final String TXT_RAT2 =
|
||||
"Please... Help me... Slay the abomination...\n\n" +
|
||||
"_Fight it near water... Avoid the stench..._";
|
||||
|
||||
private static final String TXT_GNOLL1 =
|
||||
"Hello %s... Once I was like you - strong and confident... " +
|
||||
"But I was slain by a devious foe... I can't leave this place... Not until I have my revenge... " +
|
||||
"Slay the _gnoll trickster_, that has taken my life...\n\n" +
|
||||
"It is not like the other gnolls... It hides and uses thrown weapons... " +
|
||||
"_Beware its poisonous and incendiary darts, don't attack from a distance..._";
|
||||
private static final String TXT_GNOLL1 =
|
||||
"Hello %s... Once I was like you - strong and confident... " +
|
||||
"But I was slain by a devious foe... I can't leave this place... Not until I have my revenge... " +
|
||||
"Slay the _gnoll trickster_, that has taken my life...\n\n" +
|
||||
"It is not like the other gnolls... It hides and uses thrown weapons... " +
|
||||
"_Beware its poisonous and incendiary darts, don't attack from a distance..._";
|
||||
|
||||
private static final String TXT_GNOLL2 =
|
||||
"Please... Help me... Slay the trickster...\n\n" +
|
||||
"_Don't let it hit you... Get near to it..._";
|
||||
private static final String TXT_GNOLL2 =
|
||||
"Please... Help me... Slay the trickster...\n\n" +
|
||||
"_Don't let it hit you... Get near to it..._";
|
||||
|
||||
private static final String TXT_CRAB1 =
|
||||
"Hello %s... Once I was like you - strong and confident... " +
|
||||
"But I was slain by an ancient creature... I can't leave this place... Not until I have my revenge... " +
|
||||
"Slay the _great crab_, that has taken my life...\n\n" +
|
||||
"It is unnaturally old... With a massive single claw and a thick shell... " +
|
||||
"_Beware its claw, you must surprise the crab or it will block with it..._";
|
||||
private static final String TXT_CRAB1 =
|
||||
"Hello %s... Once I was like you - strong and confident... " +
|
||||
"But I was slain by an ancient creature... I can't leave this place... Not until I have my revenge... " +
|
||||
"Slay the _great crab_, that has taken my life...\n\n" +
|
||||
"It is unnaturally old... With a massive single claw and a thick shell... " +
|
||||
"_Beware its claw, you must surprise the crab or it will block with it..._";
|
||||
|
||||
private static final String TXT_CRAB2 =
|
||||
"Please... Help me... Slay the Crustacean...\n\n" +
|
||||
"_It will always block... When it sees you coming..._";
|
||||
private static final String TXT_CRAB2 =
|
||||
"Please... Help me... Slay the Crustacean...\n\n" +
|
||||
"_It will always block... When it sees you coming..._";
|
||||
|
||||
public Ghost() {
|
||||
super();
|
||||
|
@ -156,62 +156,62 @@ public class Ghost extends NPC {
|
|||
|
||||
if (Quest.given) {
|
||||
if (Quest.weapon != null) {
|
||||
if (Quest.processed) {
|
||||
GameScene.show(new WndSadGhost(this, Quest.type));
|
||||
} else {
|
||||
switch (Quest.type) {
|
||||
case 1:
|
||||
default:
|
||||
GameScene.show(new WndQuest(this, TXT_RAT2));
|
||||
break;
|
||||
case 2:
|
||||
GameScene.show(new WndQuest(this, TXT_GNOLL2));
|
||||
break;
|
||||
case 3:
|
||||
GameScene.show(new WndQuest(this, TXT_CRAB2));
|
||||
break;
|
||||
}
|
||||
if (Quest.processed) {
|
||||
GameScene.show(new WndSadGhost(this, Quest.type));
|
||||
} else {
|
||||
switch (Quest.type) {
|
||||
case 1:
|
||||
default:
|
||||
GameScene.show(new WndQuest(this, TXT_RAT2));
|
||||
break;
|
||||
case 2:
|
||||
GameScene.show(new WndQuest(this, TXT_GNOLL2));
|
||||
break;
|
||||
case 3:
|
||||
GameScene.show(new WndQuest(this, TXT_CRAB2));
|
||||
break;
|
||||
}
|
||||
|
||||
int newPos = -1;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
newPos = Dungeon.level.randomRespawnCell();
|
||||
if (newPos != -1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (newPos != -1) {
|
||||
int newPos = -1;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
newPos = Dungeon.level.randomRespawnCell();
|
||||
if (newPos != -1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (newPos != -1) {
|
||||
|
||||
CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
|
||||
pos = newPos;
|
||||
sprite.place(pos);
|
||||
sprite.visible = Dungeon.visible[pos];
|
||||
}
|
||||
}
|
||||
}
|
||||
CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
|
||||
pos = newPos;
|
||||
sprite.place(pos);
|
||||
sprite.visible = Dungeon.visible[pos];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Mob questBoss;
|
||||
String txt_quest;
|
||||
Mob questBoss;
|
||||
String txt_quest;
|
||||
|
||||
switch (Quest.type){
|
||||
case 1: default:
|
||||
questBoss = new FetidRat();
|
||||
txt_quest = Utils.format(TXT_RAT1, Dungeon.hero.givenName()); break;
|
||||
case 2:
|
||||
questBoss = new GnollTrickster();
|
||||
txt_quest = Utils.format(TXT_GNOLL1, Dungeon.hero.givenName()); break;
|
||||
case 3:
|
||||
questBoss = new GreatCrab();
|
||||
txt_quest = Utils.format(TXT_CRAB1, Dungeon.hero.givenName()); break;
|
||||
}
|
||||
switch (Quest.type){
|
||||
case 1: default:
|
||||
questBoss = new FetidRat();
|
||||
txt_quest = Utils.format(TXT_RAT1, Dungeon.hero.givenName()); break;
|
||||
case 2:
|
||||
questBoss = new GnollTrickster();
|
||||
txt_quest = Utils.format(TXT_GNOLL1, Dungeon.hero.givenName()); break;
|
||||
case 3:
|
||||
questBoss = new GreatCrab();
|
||||
txt_quest = Utils.format(TXT_CRAB1, Dungeon.hero.givenName()); break;
|
||||
}
|
||||
|
||||
questBoss.pos = Dungeon.level.randomRespawnCell();
|
||||
questBoss.pos = Dungeon.level.randomRespawnCell();
|
||||
|
||||
if (questBoss.pos != -1) {
|
||||
GameScene.add(questBoss);
|
||||
GameScene.show( new WndQuest( this, txt_quest ) );
|
||||
Quest.given = true;
|
||||
Journal.add( Journal.Feature.GHOST );
|
||||
}
|
||||
if (questBoss.pos != -1) {
|
||||
GameScene.add(questBoss);
|
||||
GameScene.show( new WndQuest( this, txt_quest ) );
|
||||
Quest.given = true;
|
||||
Journal.add( Journal.Feature.GHOST );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ public class Ghost extends NPC {
|
|||
|
||||
private static boolean spawned;
|
||||
|
||||
private static int type;
|
||||
private static int type;
|
||||
|
||||
private static boolean given;
|
||||
private static boolean processed;
|
||||
|
@ -260,7 +260,7 @@ public class Ghost extends NPC {
|
|||
private static final String NODE = "sadGhost";
|
||||
|
||||
private static final String SPAWNED = "spawned";
|
||||
private static final String TYPE = "type";
|
||||
private static final String TYPE = "type";
|
||||
private static final String GIVEN = "given";
|
||||
private static final String PROCESSED = "processed";
|
||||
private static final String DEPTH = "depth";
|
||||
|
@ -294,9 +294,9 @@ public class Ghost extends NPC {
|
|||
|
||||
if (!node.isNull() && (spawned = node.getBoolean( SPAWNED ))) {
|
||||
|
||||
type = node.getInt(TYPE);
|
||||
given = node.getBoolean( GIVEN );
|
||||
processed = node.getBoolean( PROCESSED );
|
||||
type = node.getInt(TYPE);
|
||||
given = node.getBoolean( GIVEN );
|
||||
processed = node.getBoolean( PROCESSED );
|
||||
|
||||
depth = node.getInt( DEPTH );
|
||||
|
||||
|
@ -317,32 +317,32 @@ public class Ghost extends NPC {
|
|||
level.mobs.add( ghost );
|
||||
|
||||
spawned = true;
|
||||
//dungeon depth determines type of quest.
|
||||
//depth2=fetid rat, 3=gnoll trickster, 4=great crab
|
||||
//dungeon depth determines type of quest.
|
||||
//depth2=fetid rat, 3=gnoll trickster, 4=great crab
|
||||
type = Dungeon.depth-1;
|
||||
|
||||
given = false;
|
||||
processed = false;
|
||||
depth = Dungeon.depth;
|
||||
|
||||
do {
|
||||
weapon = Generator.randomWeapon(10);
|
||||
} while (weapon instanceof MissileWeapon);
|
||||
armor = Generator.randomArmor(10);
|
||||
do {
|
||||
weapon = Generator.randomWeapon(10);
|
||||
} while (weapon instanceof MissileWeapon);
|
||||
armor = Generator.randomArmor(10);
|
||||
|
||||
for (int i = 1; i <= 3; i++) {
|
||||
Item another;
|
||||
do {
|
||||
another = Generator.randomWeapon(10+i);
|
||||
} while (another instanceof MissileWeapon);
|
||||
if (another.level >= weapon.level) {
|
||||
weapon = (Weapon) another;
|
||||
}
|
||||
another = Generator.randomArmor(10+i);
|
||||
if (another.level >= armor.level) {
|
||||
armor = (Armor) another;
|
||||
}
|
||||
}
|
||||
for (int i = 1; i <= 3; i++) {
|
||||
Item another;
|
||||
do {
|
||||
another = Generator.randomWeapon(10+i);
|
||||
} while (another instanceof MissileWeapon);
|
||||
if (another.level >= weapon.level) {
|
||||
weapon = (Weapon) another;
|
||||
}
|
||||
another = Generator.randomArmor(10+i);
|
||||
if (another.level >= armor.level) {
|
||||
armor = (Armor) another;
|
||||
}
|
||||
}
|
||||
|
||||
weapon.identify();
|
||||
armor.identify();
|
||||
|
@ -352,9 +352,9 @@ public class Ghost extends NPC {
|
|||
public static void process() {
|
||||
if (spawned && given && !processed && (depth == Dungeon.depth)) {
|
||||
GLog.n("sad ghost: Thank you... come find me...");
|
||||
Sample.INSTANCE.play( Assets.SND_GHOST );
|
||||
processed = true;
|
||||
Generator.Category.ARTIFACT.probs[10] = 1; //flags the dried rose as spawnable.
|
||||
Sample.INSTANCE.play( Assets.SND_GHOST );
|
||||
processed = true;
|
||||
Generator.Category.ARTIFACT.probs[10] = 1; //flags the dried rose as spawnable.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -379,7 +379,7 @@ public class Ghost extends NPC {
|
|||
|
||||
EXP = 4;
|
||||
|
||||
state = WANDERING;
|
||||
state = WANDERING;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -392,14 +392,14 @@ public class Ghost extends NPC {
|
|||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int attackProc( Char enemy, int damage ) {
|
||||
if (Random.Int( 3 ) == 0) {
|
||||
Buff.affect(enemy, Ooze.class);
|
||||
}
|
||||
@Override
|
||||
public int attackProc( Char enemy, int damage ) {
|
||||
if (Random.Int( 3 ) == 0) {
|
||||
Buff.affect(enemy, Ooze.class);
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int defenseProc( Char enemy, int damage ) {
|
||||
|
@ -420,184 +420,184 @@ public class Ghost extends NPC {
|
|||
public String description() {
|
||||
return
|
||||
"Something is clearly wrong with this rat. Its greasy black fur and rotting skin are very " +
|
||||
"different from the healthy rats you've seen previously. It's pale green eyes " +
|
||||
"make it seem especially menacing.\n\n" +
|
||||
"The rat carries a cloud of horrible stench with it, it's overpoweringly strong up close.\n\n" +
|
||||
"Dark ooze dribbles from the rat's mouth, it eats through the floor but seems to dissolve in water.";
|
||||
"different from the healthy rats you've seen previously. It's pale green eyes " +
|
||||
"make it seem especially menacing.\n\n" +
|
||||
"The rat carries a cloud of horrible stench with it, it's overpoweringly strong up close.\n\n" +
|
||||
"Dark ooze dribbles from the rat's mouth, it eats through the floor but seems to dissolve in water.";
|
||||
}
|
||||
|
||||
private static final HashSet<Class<?>> IMMUNITIES = new HashSet<Class<?>>();
|
||||
static {
|
||||
IMMUNITIES.add( StenchGas.class );
|
||||
}
|
||||
private static final HashSet<Class<?>> IMMUNITIES = new HashSet<Class<?>>();
|
||||
static {
|
||||
IMMUNITIES.add( StenchGas.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<Class<?>> immunities() {
|
||||
return IMMUNITIES;
|
||||
}
|
||||
@Override
|
||||
public HashSet<Class<?>> immunities() {
|
||||
return IMMUNITIES;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static class GnollTrickster extends Gnoll {
|
||||
{
|
||||
name = "gnoll trickster";
|
||||
spriteClass = GnollTricksterSprite.class;
|
||||
public static class GnollTrickster extends Gnoll {
|
||||
{
|
||||
name = "gnoll trickster";
|
||||
spriteClass = GnollTricksterSprite.class;
|
||||
|
||||
HP = HT = 20;
|
||||
defenseSkill = 5;
|
||||
HP = HT = 20;
|
||||
defenseSkill = 5;
|
||||
|
||||
EXP = 5;
|
||||
EXP = 5;
|
||||
|
||||
state = WANDERING;
|
||||
state = WANDERING;
|
||||
|
||||
loot = Generator.random(CurareDart.class);
|
||||
lootChance = 1f;
|
||||
}
|
||||
loot = Generator.random(CurareDart.class);
|
||||
lootChance = 1f;
|
||||
}
|
||||
|
||||
private int combo = 0;
|
||||
private int combo = 0;
|
||||
|
||||
@Override
|
||||
public int attackSkill( Char target ) {
|
||||
return 16;
|
||||
}
|
||||
@Override
|
||||
public int attackSkill( Char target ) {
|
||||
return 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canAttack( Char enemy ) {
|
||||
Ballistica attack = new Ballistica( pos, enemy.pos, Ballistica.PROJECTILE );
|
||||
if (!Level.adjacent(pos, enemy.pos) && attack.collisionPos == enemy.pos){
|
||||
combo++;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected boolean canAttack( Char enemy ) {
|
||||
Ballistica attack = new Ballistica( pos, enemy.pos, Ballistica.PROJECTILE );
|
||||
if (!Level.adjacent(pos, enemy.pos) && attack.collisionPos == enemy.pos){
|
||||
combo++;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int attackProc( Char enemy, int damage ) {
|
||||
//The gnoll's attacks get more severe the more the player lets it hit them
|
||||
int effect = Random.Int(4)+combo;
|
||||
@Override
|
||||
public int attackProc( Char enemy, int damage ) {
|
||||
//The gnoll's attacks get more severe the more the player lets it hit them
|
||||
int effect = Random.Int(4)+combo;
|
||||
|
||||
if (effect > 2) {
|
||||
if (effect > 2) {
|
||||
|
||||
if (effect >=6 && enemy.buff(Burning.class) == null){
|
||||
if (effect >=6 && enemy.buff(Burning.class) == null){
|
||||
|
||||
if (Level.flamable[enemy.pos])
|
||||
GameScene.add( Blob.seed( enemy.pos, 4, Fire.class ) );
|
||||
Buff.affect( enemy, Burning.class ).reignite( enemy );
|
||||
if (Level.flamable[enemy.pos])
|
||||
GameScene.add( Blob.seed( enemy.pos, 4, Fire.class ) );
|
||||
Buff.affect( enemy, Burning.class ).reignite( enemy );
|
||||
|
||||
} else
|
||||
Buff.affect( enemy, Poison.class).set((effect-2) * Poison.durationFactor(enemy));
|
||||
} else
|
||||
Buff.affect( enemy, Poison.class).set((effect-2) * Poison.durationFactor(enemy));
|
||||
|
||||
}
|
||||
return damage;
|
||||
}
|
||||
}
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean getCloser( int target ) {
|
||||
combo = 0; //if he's moving, he isn't attacking, reset combo.
|
||||
if (enemy != null && Level.adjacent(pos, enemy.pos)) {
|
||||
return getFurther( target );
|
||||
} else {
|
||||
return super.getCloser( target );
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected boolean getCloser( int target ) {
|
||||
combo = 0; //if he's moving, he isn't attacking, reset combo.
|
||||
if (enemy != null && Level.adjacent(pos, enemy.pos)) {
|
||||
return getFurther( target );
|
||||
} else {
|
||||
return super.getCloser( target );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die( Object cause ) {
|
||||
super.die( cause );
|
||||
@Override
|
||||
public void die( Object cause ) {
|
||||
super.die( cause );
|
||||
|
||||
Quest.process();
|
||||
}
|
||||
Quest.process();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return
|
||||
"A strange looking creature, even by gnoll standards. It hunches forward with a wicked grin, " +
|
||||
"almost cradling the satchel hanging over its shoulder. Its eyes are wide with a strange mix of " +
|
||||
"fear and excitement.\n\n" +
|
||||
"There is a large collection of poorly made darts in its satchel, they all seem to be " +
|
||||
"tipped with various harmful substances.";
|
||||
}
|
||||
@Override
|
||||
public String description() {
|
||||
return
|
||||
"A strange looking creature, even by gnoll standards. It hunches forward with a wicked grin, " +
|
||||
"almost cradling the satchel hanging over its shoulder. Its eyes are wide with a strange mix of " +
|
||||
"fear and excitement.\n\n" +
|
||||
"There is a large collection of poorly made darts in its satchel, they all seem to be " +
|
||||
"tipped with various harmful substances.";
|
||||
}
|
||||
|
||||
private static final String COMBO = "combo";
|
||||
private static final String COMBO = "combo";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle(bundle);
|
||||
bundle.put(COMBO, combo);
|
||||
}
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle(bundle);
|
||||
bundle.put(COMBO, combo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
combo = bundle.getInt( COMBO );
|
||||
}
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
combo = bundle.getInt( COMBO );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static class GreatCrab extends Crab {
|
||||
{
|
||||
name = "great crab";
|
||||
spriteClass = GreatCrabSprite.class;
|
||||
public static class GreatCrab extends Crab {
|
||||
{
|
||||
name = "great crab";
|
||||
spriteClass = GreatCrabSprite.class;
|
||||
|
||||
HP = HT = 30;
|
||||
defenseSkill = 0; //see damage()
|
||||
baseSpeed = 1f;
|
||||
HP = HT = 30;
|
||||
defenseSkill = 0; //see damage()
|
||||
baseSpeed = 1f;
|
||||
|
||||
EXP = 6;
|
||||
EXP = 6;
|
||||
|
||||
state = WANDERING;
|
||||
}
|
||||
state = WANDERING;
|
||||
}
|
||||
|
||||
private int moving = 0;
|
||||
private int moving = 0;
|
||||
|
||||
@Override
|
||||
protected boolean getCloser( int target ) {
|
||||
//this is used so that the crab remains slower, but still detects the player at the expected rate.
|
||||
moving++;
|
||||
if (moving < 3) {
|
||||
return super.getCloser( target );
|
||||
} else {
|
||||
moving = 0;
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean getCloser( int target ) {
|
||||
//this is used so that the crab remains slower, but still detects the player at the expected rate.
|
||||
moving++;
|
||||
if (moving < 3) {
|
||||
return super.getCloser( target );
|
||||
} else {
|
||||
moving = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damage( int dmg, Object src ){
|
||||
//crab blocks all attacks originating from the hero or enemy characters or traps if it is alerted.
|
||||
//All direct damage from these sources is negated, no exceptions. blob/debuff effects go through as normal.
|
||||
if (enemySeen && (src instanceof Wand || src instanceof LightningTrap.Electricity || src instanceof Char)){
|
||||
GLog.n("The crab notices the attack and blocks with its massive claw.");
|
||||
sprite.showStatus( CharSprite.NEUTRAL, "blocked" );
|
||||
} else {
|
||||
super.damage( dmg, src );
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void damage( int dmg, Object src ){
|
||||
//crab blocks all attacks originating from the hero or enemy characters or traps if it is alerted.
|
||||
//All direct damage from these sources is negated, no exceptions. blob/debuff effects go through as normal.
|
||||
if (enemySeen && (src instanceof Wand || src instanceof LightningTrap.Electricity || src instanceof Char)){
|
||||
GLog.n("The crab notices the attack and blocks with its massive claw.");
|
||||
sprite.showStatus( CharSprite.NEUTRAL, "blocked" );
|
||||
} else {
|
||||
super.damage( dmg, src );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die( Object cause ) {
|
||||
super.die( cause );
|
||||
@Override
|
||||
public void die( Object cause ) {
|
||||
super.die( cause );
|
||||
|
||||
Quest.process();
|
||||
Quest.process();
|
||||
|
||||
Dungeon.level.drop( new MysteryMeat(), pos );
|
||||
Dungeon.level.drop( new MysteryMeat(), pos ).sprite.drop();
|
||||
}
|
||||
Dungeon.level.drop( new MysteryMeat(), pos );
|
||||
Dungeon.level.drop( new MysteryMeat(), pos ).sprite.drop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return
|
||||
"This crab is gigantic, even compared to other sewer crabs. " +
|
||||
"Its blue shell is covered in cracks and barnacles, showing great age. " +
|
||||
"It lumbers around slowly, barely keeping balance with its massive claw.\n\n" +
|
||||
"While the crab only has one claw, its size easily compensates. " +
|
||||
"The crab holds the claw infront of itself whenever it sees a threat, shielding " +
|
||||
"itself behind an impenetrable wall of carapace.";
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String description() {
|
||||
return
|
||||
"This crab is gigantic, even compared to other sewer crabs. " +
|
||||
"Its blue shell is covered in cracks and barnacles, showing great age. " +
|
||||
"It lumbers around slowly, barely keeping balance with its massive claw.\n\n" +
|
||||
"While the crab only has one claw, its size easily compensates. " +
|
||||
"The crab holds the claw infront of itself whenever it sees a threat, shielding " +
|
||||
"itself behind an impenetrable wall of carapace.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
|||
public class ImpShopkeeper extends Shopkeeper {
|
||||
|
||||
private static final String TXT_GREETINGS = "Hello, %s!";
|
||||
public static final String TXT_THIEF = "I thought I could trust you!";
|
||||
public static final String TXT_THIEF = "I thought I could trust you!";
|
||||
|
||||
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ public class ImpShopkeeper extends Shopkeeper {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void flee() {
|
||||
public void flee() {
|
||||
for (Heap heap: Dungeon.level.heaps.values()) {
|
||||
if (heap.type == Heap.Type.FOR_SALE) {
|
||||
CellEmitter.get( heap.pos ).burst( ElmoParticle.FACTORY, 4 );
|
||||
|
|
|
@ -135,16 +135,16 @@ public class MirrorImage extends NPC {
|
|||
|
||||
Dungeon.hero.spend( 1 / Dungeon.hero.speed() );
|
||||
Dungeon.hero.busy();
|
||||
}
|
||||
}
|
||||
|
||||
private static final HashSet<Class<?>> IMMUNITIES = new HashSet<Class<?>>();
|
||||
static {
|
||||
IMMUNITIES.add( ToxicGas.class );
|
||||
IMMUNITIES.add( Burning.class );
|
||||
}
|
||||
private static final HashSet<Class<?>> IMMUNITIES = new HashSet<Class<?>>();
|
||||
static {
|
||||
IMMUNITIES.add( ToxicGas.class );
|
||||
IMMUNITIES.add( Burning.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<Class<?>> immunities() {
|
||||
return IMMUNITIES;
|
||||
@Override
|
||||
public HashSet<Class<?>> immunities() {
|
||||
return IMMUNITIES;
|
||||
}
|
||||
}
|
|
@ -25,28 +25,28 @@ import com.watabou.utils.Random;
|
|||
|
||||
public abstract class NPC extends Mob {
|
||||
|
||||
{
|
||||
HP = HT = 1;
|
||||
EXP = 0;
|
||||
{
|
||||
HP = HT = 1;
|
||||
EXP = 0;
|
||||
|
||||
hostile = false;
|
||||
state = PASSIVE;
|
||||
}
|
||||
hostile = false;
|
||||
state = PASSIVE;
|
||||
}
|
||||
|
||||
protected void throwItem() {
|
||||
Heap heap = Dungeon.level.heaps.get( pos );
|
||||
if (heap != null) {
|
||||
int n;
|
||||
do {
|
||||
n = pos + Level.NEIGHBOURS8[Random.Int( 8 )];
|
||||
} while (!Level.passable[n] && !Level.avoid[n]);
|
||||
Dungeon.level.drop( heap.pickUp(), n ).sprite.drop( pos );
|
||||
}
|
||||
}
|
||||
protected void throwItem() {
|
||||
Heap heap = Dungeon.level.heaps.get( pos );
|
||||
if (heap != null) {
|
||||
int n;
|
||||
do {
|
||||
n = pos + Level.NEIGHBOURS8[Random.Int( 8 )];
|
||||
} while (!Level.passable[n] && !Level.avoid[n]);
|
||||
Dungeon.level.drop( heap.pickUp(), n ).sprite.drop( pos );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beckon( int cell ) {
|
||||
}
|
||||
@Override
|
||||
public void beckon( int cell ) {
|
||||
}
|
||||
|
||||
abstract public void interact();
|
||||
abstract public void interact();
|
||||
}
|
|
@ -31,7 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndTradeItem;
|
|||
|
||||
public class Shopkeeper extends NPC {
|
||||
|
||||
public static final String TXT_THIEF = "Thief, Thief!";
|
||||
public static final String TXT_THIEF = "Thief, Thief!";
|
||||
|
||||
{
|
||||
name = "shopkeeper";
|
||||
|
|
|
@ -126,8 +126,8 @@ public class Wandmaker extends NPC {
|
|||
|
||||
Quest.placeItem();
|
||||
|
||||
if (Quest.given)
|
||||
tell(Quest.alternative ? TXT_DUST1 : TXT_BERRY1);
|
||||
if (Quest.given)
|
||||
tell(Quest.alternative ? TXT_DUST1 : TXT_BERRY1);
|
||||
|
||||
Journal.add( Journal.Feature.WANDMAKER );
|
||||
}
|
||||
|
@ -241,19 +241,19 @@ public class Wandmaker extends NPC {
|
|||
|
||||
if (candidates.size() > 0) {
|
||||
Random.element( candidates ).drop( new CorpseDust() );
|
||||
given = true;
|
||||
given = true;
|
||||
} else {
|
||||
int pos = Dungeon.level.randomRespawnCell();
|
||||
while (Dungeon.level.heaps.get( pos ) != null) {
|
||||
pos = Dungeon.level.randomRespawnCell();
|
||||
}
|
||||
|
||||
if (pos != -1) {
|
||||
Heap heap = Dungeon.level.drop(new CorpseDust(), pos);
|
||||
heap.type = Heap.Type.SKELETON;
|
||||
heap.sprite.link();
|
||||
given = true;
|
||||
}
|
||||
if (pos != -1) {
|
||||
Heap heap = Dungeon.level.drop(new CorpseDust(), pos);
|
||||
heap.type = Heap.Type.SKELETON;
|
||||
heap.sprite.link();
|
||||
given = true;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -263,10 +263,10 @@ public class Wandmaker extends NPC {
|
|||
shrubPos = Dungeon.level.randomRespawnCell();
|
||||
}
|
||||
|
||||
if (shrubPos != -1) {
|
||||
Dungeon.level.plant(new Rotberry.Seed(), shrubPos);
|
||||
given = true;
|
||||
}
|
||||
if (shrubPos != -1) {
|
||||
Dungeon.level.plant(new Rotberry.Seed(), shrubPos);
|
||||
given = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -208,9 +208,9 @@ public class BadgeBanner extends Image {
|
|||
break;
|
||||
case 38:
|
||||
p.offset( 5, 5 );
|
||||
break;
|
||||
case 39:
|
||||
p.offset( 5, 4 );
|
||||
break;
|
||||
case 39:
|
||||
p.offset( 5, 4 );
|
||||
break;
|
||||
case 40:
|
||||
case 41:
|
||||
|
|
|
@ -22,33 +22,33 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
|||
|
||||
public class BannerSprites {
|
||||
|
||||
public enum Type {
|
||||
PIXEL_DUNGEON,
|
||||
BOSS_SLAIN,
|
||||
GAME_OVER,
|
||||
SELECT_YOUR_HERO,
|
||||
PIXEL_DUNGEON_SIGNS
|
||||
};
|
||||
public enum Type {
|
||||
PIXEL_DUNGEON,
|
||||
BOSS_SLAIN,
|
||||
GAME_OVER,
|
||||
SELECT_YOUR_HERO,
|
||||
PIXEL_DUNGEON_SIGNS
|
||||
};
|
||||
|
||||
public static Image get( Type type ) {
|
||||
Image icon = new Image( Assets.BANNERS );
|
||||
switch (type) {
|
||||
case PIXEL_DUNGEON:
|
||||
icon.frame( icon.texture.uvRect( 0, 0, 128, 70 ) );
|
||||
break;
|
||||
case BOSS_SLAIN:
|
||||
icon.frame( icon.texture.uvRect( 0, 70, 128, 105 ) );
|
||||
break;
|
||||
case GAME_OVER:
|
||||
icon.frame( icon.texture.uvRect( 0, 105, 128, 140 ) );
|
||||
break;
|
||||
case SELECT_YOUR_HERO:
|
||||
icon.frame( icon.texture.uvRect( 0, 140, 128, 161 ) );
|
||||
break;
|
||||
case PIXEL_DUNGEON_SIGNS:
|
||||
icon.frame( icon.texture.uvRect( 0, 161, 128, 218 ) );
|
||||
break;
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
public static Image get( Type type ) {
|
||||
Image icon = new Image( Assets.BANNERS );
|
||||
switch (type) {
|
||||
case PIXEL_DUNGEON:
|
||||
icon.frame( icon.texture.uvRect( 0, 0, 128, 70 ) );
|
||||
break;
|
||||
case BOSS_SLAIN:
|
||||
icon.frame( icon.texture.uvRect( 0, 70, 128, 105 ) );
|
||||
break;
|
||||
case GAME_OVER:
|
||||
icon.frame( icon.texture.uvRect( 0, 105, 128, 140 ) );
|
||||
break;
|
||||
case SELECT_YOUR_HERO:
|
||||
icon.frame( icon.texture.uvRect( 0, 140, 128, 161 ) );
|
||||
break;
|
||||
case PIXEL_DUNGEON_SIGNS:
|
||||
icon.frame( icon.texture.uvRect( 0, 161, 128, 218 ) );
|
||||
break;
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,6 @@ import com.watabou.noosa.Image;
|
|||
import com.watabou.utils.Callback;
|
||||
import com.watabou.utils.PointF;
|
||||
|
||||
/**
|
||||
* Created by Evan on 23/05/2015.
|
||||
*/
|
||||
public class Chains extends Group {
|
||||
|
||||
private static final double A = 180 / Math.PI;
|
||||
|
|
|
@ -6,9 +6,6 @@ import com.watabou.noosa.Game;
|
|||
import com.watabou.noosa.Gizmo;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
|
||||
/**
|
||||
* Created by Evan on 14/05/2015.
|
||||
*/
|
||||
public class DarkBlock extends Gizmo{
|
||||
|
||||
private CharSprite target;
|
||||
|
|
|
@ -58,9 +58,9 @@ public class Speck extends Image {
|
|||
public static final int VENOM = 108;
|
||||
public static final int PARALYSIS = 109;
|
||||
public static final int DUST = 110;
|
||||
public static final int STENCH = 111;
|
||||
public static final int STENCH = 111;
|
||||
public static final int FORGE = 112;
|
||||
public static final int CONFUSION = 113;
|
||||
public static final int CONFUSION = 113;
|
||||
|
||||
private static final int SIZE = 7;
|
||||
|
||||
|
@ -104,8 +104,8 @@ public class Speck extends Image {
|
|||
case TOXIC:
|
||||
case VENOM:
|
||||
case PARALYSIS:
|
||||
case STENCH:
|
||||
case CONFUSION:
|
||||
case STENCH:
|
||||
case CONFUSION:
|
||||
case DUST:
|
||||
frame( film.get( STEAM ) );
|
||||
break;
|
||||
|
@ -287,28 +287,28 @@ public class Speck extends Image {
|
|||
lifespan = Random.Float( 1f, 3f );
|
||||
break;
|
||||
|
||||
case STENCH:
|
||||
hardlight( 0x003300 );
|
||||
angularSpeed = -30;
|
||||
angle = Random.Float( 360 );
|
||||
lifespan = Random.Float( 1f, 3f );
|
||||
break;
|
||||
case STENCH:
|
||||
hardlight( 0x003300 );
|
||||
angularSpeed = -30;
|
||||
angle = Random.Float( 360 );
|
||||
lifespan = Random.Float( 1f, 3f );
|
||||
break;
|
||||
|
||||
case CONFUSION:
|
||||
hardlight( Random.Int( 0x1000000 ) | 0x000080 );
|
||||
angularSpeed = Random.Float( -20, +20 );
|
||||
angle = Random.Float( 360 );
|
||||
lifespan = Random.Float( 1f, 3f );
|
||||
break;
|
||||
case CONFUSION:
|
||||
hardlight( Random.Int( 0x1000000 ) | 0x000080 );
|
||||
angularSpeed = Random.Float( -20, +20 );
|
||||
angle = Random.Float( 360 );
|
||||
lifespan = Random.Float( 1f, 3f );
|
||||
break;
|
||||
|
||||
case DUST:
|
||||
hardlight( 0xFFFF66 );
|
||||
angle = Random.Float( 360 );
|
||||
speed.polar( Random.Float( 2 * 3.1415926f ), Random.Float( 16, 48 ) );
|
||||
lifespan = 0.5f;
|
||||
break;
|
||||
case DUST:
|
||||
hardlight( 0xFFFF66 );
|
||||
angle = Random.Float( 360 );
|
||||
speed.polar( Random.Float( 2 * 3.1415926f ), Random.Float( 16, 48 ) );
|
||||
lifespan = 0.5f;
|
||||
break;
|
||||
|
||||
case COIN:
|
||||
case COIN:
|
||||
speed.polar( -PointF.PI * Random.Float( 0.3f, 0.7f ), Random.Float( 48, 96 ) );
|
||||
acc.y = 256;
|
||||
lifespan = -speed.y / acc.y * 2;
|
||||
|
@ -408,7 +408,7 @@ public class Speck extends Image {
|
|||
case STEAM:
|
||||
case TOXIC:
|
||||
case PARALYSIS:
|
||||
case CONFUSION:
|
||||
case CONFUSION:
|
||||
case DUST:
|
||||
am = p < 0.5f ? p : 1 - p;
|
||||
scale.set( 1 + p * 2 );
|
||||
|
@ -416,10 +416,10 @@ public class Speck extends Image {
|
|||
|
||||
case VENOM:
|
||||
hardlight( ColorMath.interpolate( 0x8844FF, 0x00FF00 , p ));
|
||||
case STENCH:
|
||||
am = (p < 0.5f ? p : 1 - p) * 2;
|
||||
scale.set( 1 + p * 2 );
|
||||
break;
|
||||
case STENCH:
|
||||
am = (p < 0.5f ? p : 1 - p) * 2;
|
||||
scale.set( 1 + p * 2 );
|
||||
break;
|
||||
|
||||
case JET:
|
||||
am = (p < 0.5f ? p : 1 - p) * 2;
|
||||
|
@ -435,29 +435,29 @@ public class Speck extends Image {
|
|||
}
|
||||
}
|
||||
|
||||
public static Emitter.Factory factory( final int type ) {
|
||||
return factory( type, false );
|
||||
}
|
||||
public static Emitter.Factory factory( final int type ) {
|
||||
return factory( type, false );
|
||||
}
|
||||
|
||||
public static Emitter.Factory factory( final int type, final boolean lightMode ) {
|
||||
public static Emitter.Factory factory( final int type, final boolean lightMode ) {
|
||||
|
||||
Emitter.Factory factory = factories.get( type );
|
||||
Emitter.Factory factory = factories.get( type );
|
||||
|
||||
if (factory == null) {
|
||||
factory = new Emitter.Factory() {
|
||||
@Override
|
||||
public void emit ( Emitter emitter, int index, float x, float y ) {
|
||||
Speck p = (Speck)emitter.recycle( Speck.class );
|
||||
p.reset( index, x, y, type );
|
||||
}
|
||||
@Override
|
||||
public boolean lightMode() {
|
||||
return lightMode;
|
||||
}
|
||||
};
|
||||
factories.put( type, factory );
|
||||
}
|
||||
if (factory == null) {
|
||||
factory = new Emitter.Factory() {
|
||||
@Override
|
||||
public void emit ( Emitter emitter, int index, float x, float y ) {
|
||||
Speck p = (Speck)emitter.recycle( Speck.class );
|
||||
p.reset( index, x, y, type );
|
||||
}
|
||||
@Override
|
||||
public boolean lightMode() {
|
||||
return lightMode;
|
||||
}
|
||||
};
|
||||
factories.put( type, factory );
|
||||
}
|
||||
|
||||
return factory;
|
||||
}
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,64 +8,61 @@ import com.watabou.noosa.Game;
|
|||
import com.watabou.noosa.Group;
|
||||
import com.watabou.noosa.Image;
|
||||
|
||||
/**
|
||||
* Created by Evan on 20/04/2015.
|
||||
*/
|
||||
public class Surprise extends Image {
|
||||
|
||||
private static final float TIME_TO_FADE = 0.8f;
|
||||
private static final float TIME_TO_FADE = 0.8f;
|
||||
|
||||
private float time;
|
||||
private float time;
|
||||
|
||||
public Surprise() {
|
||||
super(Effects.get(Effects.Type.EXCLAMATION));
|
||||
origin.set(width / 2, height / 2);
|
||||
}
|
||||
public Surprise() {
|
||||
super(Effects.get(Effects.Type.EXCLAMATION));
|
||||
origin.set(width / 2, height / 2);
|
||||
}
|
||||
|
||||
public void reset(int p) {
|
||||
revive();
|
||||
public void reset(int p) {
|
||||
revive();
|
||||
|
||||
x = (p % Level.WIDTH) * DungeonTilemap.SIZE + (DungeonTilemap.SIZE - width) / 2;
|
||||
y = (p / Level.WIDTH) * DungeonTilemap.SIZE + (DungeonTilemap.SIZE - height) / 2;
|
||||
x = (p % Level.WIDTH) * DungeonTilemap.SIZE + (DungeonTilemap.SIZE - width) / 2;
|
||||
y = (p / Level.WIDTH) * DungeonTilemap.SIZE + (DungeonTilemap.SIZE - height) / 2;
|
||||
|
||||
time = TIME_TO_FADE;
|
||||
}
|
||||
time = TIME_TO_FADE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
||||
if ((time -= Game.elapsed) <= 0) {
|
||||
kill();
|
||||
} else {
|
||||
float p = time / TIME_TO_FADE;
|
||||
alpha(p);
|
||||
scale.y = 1 + p/2;
|
||||
}
|
||||
}
|
||||
if ((time -= Game.elapsed) <= 0) {
|
||||
kill();
|
||||
} else {
|
||||
float p = time / TIME_TO_FADE;
|
||||
alpha(p);
|
||||
scale.y = 1 + p/2;
|
||||
}
|
||||
}
|
||||
|
||||
public static void hit(Char ch) {
|
||||
hit(ch, 0);
|
||||
}
|
||||
public static void hit(Char ch) {
|
||||
hit(ch, 0);
|
||||
}
|
||||
|
||||
public static void hit(Char ch, float angle) {
|
||||
if (ch.sprite.parent != null) {
|
||||
Surprise s = (Surprise) ch.sprite.parent.recycle(Surprise.class);
|
||||
ch.sprite.parent.bringToFront(s);
|
||||
s.reset(ch.pos);
|
||||
s.angle = angle;
|
||||
}
|
||||
}
|
||||
public static void hit(Char ch, float angle) {
|
||||
if (ch.sprite.parent != null) {
|
||||
Surprise s = (Surprise) ch.sprite.parent.recycle(Surprise.class);
|
||||
ch.sprite.parent.bringToFront(s);
|
||||
s.reset(ch.pos);
|
||||
s.angle = angle;
|
||||
}
|
||||
}
|
||||
|
||||
public static void hit(int pos) {
|
||||
hit(pos, 0);
|
||||
}
|
||||
public static void hit(int pos) {
|
||||
hit(pos, 0);
|
||||
}
|
||||
|
||||
public static void hit(int pos, float angle) {
|
||||
Group parent = Dungeon.hero.sprite.parent;
|
||||
Wound w = (Wound) parent.recycle(Wound.class);
|
||||
parent.bringToFront(w);
|
||||
w.reset(pos);
|
||||
w.angle = angle;
|
||||
}
|
||||
public static void hit(int pos, float angle) {
|
||||
Group parent = Dungeon.hero.sprite.parent;
|
||||
Wound w = (Wound) parent.recycle(Wound.class);
|
||||
parent.bringToFront(w);
|
||||
w.reset(pos);
|
||||
w.angle = angle;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,12 +63,12 @@ public class Wound extends Image {
|
|||
}
|
||||
|
||||
public static void hit( Char ch, float angle ) {
|
||||
if (ch.sprite.parent != null) {
|
||||
Wound w = (Wound) ch.sprite.parent.recycle(Wound.class);
|
||||
ch.sprite.parent.bringToFront(w);
|
||||
w.reset(ch.pos);
|
||||
w.angle = angle;
|
||||
}
|
||||
if (ch.sprite.parent != null) {
|
||||
Wound w = (Wound) ch.sprite.parent.recycle(Wound.class);
|
||||
ch.sprite.parent.bringToFront(w);
|
||||
w.reset(ch.pos);
|
||||
w.angle = angle;
|
||||
}
|
||||
}
|
||||
|
||||
public static void hit( int pos ) {
|
||||
|
|
|
@ -5,56 +5,53 @@ import com.watabou.noosa.particles.PixelParticle;
|
|||
import com.watabou.utils.PointF;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
/**
|
||||
* Created by Evan on 11/04/2015.
|
||||
*/
|
||||
public class RainbowParticle extends PixelParticle {
|
||||
|
||||
public static final Emitter.Factory BURST = new Emitter.Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((RainbowParticle)emitter.recycle( RainbowParticle.class )).resetBurst( x, y );
|
||||
}
|
||||
@Override
|
||||
public boolean lightMode() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
public static final Emitter.Factory BURST = new Emitter.Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((RainbowParticle)emitter.recycle( RainbowParticle.class )).resetBurst( x, y );
|
||||
}
|
||||
@Override
|
||||
public boolean lightMode() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public RainbowParticle() {
|
||||
super();
|
||||
color( Random.Int( 0x1000000 ) );
|
||||
lifespan = 0.5f;
|
||||
}
|
||||
public RainbowParticle() {
|
||||
super();
|
||||
color( Random.Int( 0x1000000 ) );
|
||||
lifespan = 0.5f;
|
||||
}
|
||||
|
||||
|
||||
public void reset( float x, float y ) {
|
||||
revive();
|
||||
public void reset( float x, float y ) {
|
||||
revive();
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
speed.set( Random.Float(-5, +5), Random.Float( -5, +5 ) );
|
||||
speed.set( Random.Float(-5, +5), Random.Float( -5, +5 ) );
|
||||
|
||||
left = lifespan;
|
||||
}
|
||||
left = lifespan;
|
||||
}
|
||||
|
||||
public void resetBurst( float x, float y ) {
|
||||
revive();
|
||||
public void resetBurst( float x, float y ) {
|
||||
revive();
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
speed.polar( Random.Float( PointF.PI2 ), Random.Float( 16, 32 ) );
|
||||
speed.polar( Random.Float( PointF.PI2 ), Random.Float( 16, 32 ) );
|
||||
|
||||
left = lifespan;
|
||||
}
|
||||
left = lifespan;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
// alpha: 1 -> 0; size: 1 -> 5
|
||||
size( 5 - (am = left / lifespan) * 4 );
|
||||
}
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
// alpha: 1 -> 0; size: 1 -> 5
|
||||
size( 5 - (am = left / lifespan) * 4 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,28 +31,28 @@ import java.util.ArrayList;
|
|||
|
||||
public class Ankh extends Item {
|
||||
|
||||
public static final String AC_BLESS = "BLESS";
|
||||
public static final String AC_BLESS = "BLESS";
|
||||
|
||||
public static final String TXT_DESC_NOBLESS = "Upon resurrection all non-equipped items are lost. " +
|
||||
"Using a full dew vial, the ankh can be blessed with extra strength.";
|
||||
public static final String TXT_DESC_BLESSED = "The ankh has been blessed and is now much stronger. " +
|
||||
"The Ankh will sacrifice itself to save you in a moment of deadly peril.";
|
||||
public static final String TXT_DESC_NOBLESS = "Upon resurrection all non-equipped items are lost. " +
|
||||
"Using a full dew vial, the ankh can be blessed with extra strength.";
|
||||
public static final String TXT_DESC_BLESSED = "The ankh has been blessed and is now much stronger. " +
|
||||
"The Ankh will sacrifice itself to save you in a moment of deadly peril.";
|
||||
|
||||
public static final String TXT_BLESS = "You bless the ankh with clean water.";
|
||||
public static final String TXT_REVIVE = "The ankh explodes with life-giving energy!";
|
||||
public static final String TXT_BLESS = "You bless the ankh with clean water.";
|
||||
public static final String TXT_REVIVE = "The ankh explodes with life-giving energy!";
|
||||
|
||||
|
||||
|
||||
{
|
||||
{
|
||||
name = "Ankh";
|
||||
image = ItemSpriteSheet.ANKH;
|
||||
|
||||
//You tell the ankh no, don't revive me, and then it comes back to revive you again in another run.
|
||||
//I'm not sure if that's enthusiasm or passive-aggression.
|
||||
bones = true;
|
||||
}
|
||||
//You tell the ankh no, don't revive me, and then it comes back to revive you again in another run.
|
||||
//I'm not sure if that's enthusiasm or passive-aggression.
|
||||
bones = true;
|
||||
}
|
||||
|
||||
private Boolean blessed = false;
|
||||
private Boolean blessed = false;
|
||||
|
||||
@Override
|
||||
public boolean isUpgradable() {
|
||||
|
@ -64,76 +64,76 @@ public class Ankh extends Item {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions(hero);
|
||||
DewVial vial = hero.belongings.getItem(DewVial.class);
|
||||
if (vial != null && vial.isFull() && !blessed)
|
||||
actions.add( AC_BLESS );
|
||||
return actions;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions(hero);
|
||||
DewVial vial = hero.belongings.getItem(DewVial.class);
|
||||
if (vial != null && vial.isFull() && !blessed)
|
||||
actions.add( AC_BLESS );
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute( final Hero hero, String action ) {
|
||||
if (action.equals( AC_BLESS )) {
|
||||
@Override
|
||||
public void execute( final Hero hero, String action ) {
|
||||
if (action.equals( AC_BLESS )) {
|
||||
|
||||
DewVial vial = hero.belongings.getItem(DewVial.class);
|
||||
if (vial != null){
|
||||
blessed = true;
|
||||
vial.empty();
|
||||
GLog.p( TXT_BLESS );
|
||||
hero.spend( 1f );
|
||||
hero.busy();
|
||||
DewVial vial = hero.belongings.getItem(DewVial.class);
|
||||
if (vial != null){
|
||||
blessed = true;
|
||||
vial.empty();
|
||||
GLog.p( TXT_BLESS );
|
||||
hero.spend( 1f );
|
||||
hero.busy();
|
||||
|
||||
|
||||
Sample.INSTANCE.play( Assets.SND_DRINK );
|
||||
CellEmitter.get(hero.pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
|
||||
hero.sprite.operate( hero.pos );
|
||||
}
|
||||
} else {
|
||||
Sample.INSTANCE.play( Assets.SND_DRINK );
|
||||
CellEmitter.get(hero.pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
|
||||
hero.sprite.operate( hero.pos );
|
||||
}
|
||||
} else {
|
||||
|
||||
super.execute( hero, action );
|
||||
super.execute( hero, action );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String info() {
|
||||
if (blessed)
|
||||
return
|
||||
"This ancient symbol of immortality grants the ability to return to life after death. " +
|
||||
TXT_DESC_BLESSED;
|
||||
else
|
||||
return
|
||||
return
|
||||
"This ancient symbol of immortality grants the ability to return to life after death. " +
|
||||
TXT_DESC_NOBLESS;
|
||||
TXT_DESC_BLESSED;
|
||||
else
|
||||
return
|
||||
"This ancient symbol of immortality grants the ability to return to life after death. " +
|
||||
TXT_DESC_NOBLESS;
|
||||
}
|
||||
|
||||
public Boolean isBlessed(){
|
||||
return blessed;
|
||||
}
|
||||
public Boolean isBlessed(){
|
||||
return blessed;
|
||||
}
|
||||
|
||||
private static final Glowing WHITE = new Glowing( 0xFFFFCC );
|
||||
private static final Glowing WHITE = new Glowing( 0xFFFFCC );
|
||||
|
||||
@Override
|
||||
public Glowing glowing() {
|
||||
return isBlessed() ? WHITE : null;
|
||||
}
|
||||
@Override
|
||||
public Glowing glowing() {
|
||||
return isBlessed() ? WHITE : null;
|
||||
}
|
||||
|
||||
private static final String BLESSED = "blessed";
|
||||
private static final String BLESSED = "blessed";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( BLESSED, blessed );
|
||||
}
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( BLESSED, blessed );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
blessed = bundle.getBoolean( BLESSED );
|
||||
}
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
blessed = bundle.getBoolean( BLESSED );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int price() {
|
||||
|
|
|
@ -53,48 +53,48 @@ public class Bomb extends Item {
|
|||
|
||||
public Fuse fuse;
|
||||
|
||||
//FIXME using a static variable for this is kinda gross, should be a better way
|
||||
private static boolean lightingFuse = false;
|
||||
//FIXME using a static variable for this is kinda gross, should be a better way
|
||||
private static boolean lightingFuse = false;
|
||||
|
||||
private static final String AC_LIGHTTHROW = "Light & Throw";
|
||||
|
||||
@Override
|
||||
public boolean isSimilar(Item item) {
|
||||
return item instanceof Bomb && this.fuse == ((Bomb) item).fuse;
|
||||
}
|
||||
@Override
|
||||
public boolean isSimilar(Item item) {
|
||||
return item instanceof Bomb && this.fuse == ((Bomb) item).fuse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> actions(Hero hero) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
actions.add ( AC_LIGHTTHROW );
|
||||
return actions;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<String> actions(Hero hero) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
actions.add ( AC_LIGHTTHROW );
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Hero hero, String action) {
|
||||
if (action.equals( AC_LIGHTTHROW )){
|
||||
lightingFuse = true;
|
||||
action = AC_THROW;
|
||||
} else
|
||||
lightingFuse = false;
|
||||
@Override
|
||||
public void execute(Hero hero, String action) {
|
||||
if (action.equals( AC_LIGHTTHROW )){
|
||||
lightingFuse = true;
|
||||
action = AC_THROW;
|
||||
} else
|
||||
lightingFuse = false;
|
||||
|
||||
super.execute(hero, action);
|
||||
}
|
||||
super.execute(hero, action);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
protected void onThrow( int cell ) {
|
||||
if (!Level.pit[ cell ] && lightingFuse) {
|
||||
Actor.addDelayed(fuse = new Fuse().ignite(this), 2);
|
||||
}
|
||||
if (Actor.findChar( cell ) != null && !(Actor.findChar( cell ) instanceof Hero) ){
|
||||
ArrayList<Integer> candidates = new ArrayList<>();
|
||||
for (int i : Level.NEIGHBOURS8)
|
||||
if (Level.passable[cell + i])
|
||||
candidates.add(cell + i);
|
||||
int newCell = candidates.isEmpty() ? cell : Random.element(candidates);
|
||||
Dungeon.level.drop( this, newCell ).sprite.drop( cell );
|
||||
} else
|
||||
super.onThrow( cell );
|
||||
if (!Level.pit[ cell ] && lightingFuse) {
|
||||
Actor.addDelayed(fuse = new Fuse().ignite(this), 2);
|
||||
}
|
||||
if (Actor.findChar( cell ) != null && !(Actor.findChar( cell ) instanceof Hero) ){
|
||||
ArrayList<Integer> candidates = new ArrayList<>();
|
||||
for (int i : Level.NEIGHBOURS8)
|
||||
if (Level.passable[cell + i])
|
||||
candidates.add(cell + i);
|
||||
int newCell = candidates.isEmpty() ? cell : Random.element(candidates);
|
||||
Dungeon.level.drop( this, newCell ).sprite.drop( cell );
|
||||
} else
|
||||
super.onThrow( cell );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -138,8 +138,8 @@ public class Bomb extends Item {
|
|||
Char ch = Actor.findChar( c );
|
||||
if (ch != null) {
|
||||
//those not at the center of the blast take damage less consistently.
|
||||
int minDamage = c == cell ? Dungeon.depth+5 : 1;
|
||||
int maxDamage = 10 + Dungeon.depth * 2;
|
||||
int minDamage = c == cell ? Dungeon.depth+5 : 1;
|
||||
int maxDamage = 10 + Dungeon.depth * 2;
|
||||
|
||||
int dmg = Random.NormalIntRange( minDamage, maxDamage ) - Random.Int( ch.dr() );
|
||||
if (dmg > 0) {
|
||||
|
|
|
@ -87,12 +87,12 @@ public class DewVial extends Item {
|
|||
|
||||
if (volume > 0) {
|
||||
|
||||
int value = 1 + (Dungeon.depth - 1) / 5;
|
||||
if (hero.heroClass == HeroClass.HUNTRESS) {
|
||||
value++;
|
||||
}
|
||||
value *= volume;
|
||||
value = (int)Math.max(volume*volume*.01*hero.HT, value);
|
||||
int value = 1 + (Dungeon.depth - 1) / 5;
|
||||
if (hero.heroClass == HeroClass.HUNTRESS) {
|
||||
value++;
|
||||
}
|
||||
value *= volume;
|
||||
value = (int)Math.max(volume*volume*.01*hero.HT, value);
|
||||
int effect = Math.min( hero.HT - hero.HP, value );
|
||||
if (effect > 0) {
|
||||
hero.HP += effect;
|
||||
|
@ -100,7 +100,7 @@ public class DewVial extends Item {
|
|||
hero.sprite.showStatus( CharSprite.POSITIVE, TXT_VALUE, effect );
|
||||
}
|
||||
|
||||
volume = 0;
|
||||
volume = 0;
|
||||
|
||||
hero.spend( TIME_TO_DRINK );
|
||||
hero.busy();
|
||||
|
@ -122,7 +122,7 @@ public class DewVial extends Item {
|
|||
}
|
||||
}
|
||||
|
||||
public void empty() {volume = 0; updateQuickslot();}
|
||||
public void empty() {volume = 0; updateQuickslot();}
|
||||
|
||||
@Override
|
||||
public boolean isUpgradable() {
|
||||
|
@ -156,7 +156,7 @@ public class DewVial extends Item {
|
|||
}
|
||||
|
||||
//removed as people need a bigger distinction to realize the dew vial doesn't revive.
|
||||
/*
|
||||
/*
|
||||
private static final Glowing WHITE = new Glowing( 0xFFFFCC );
|
||||
|
||||
@Override
|
||||
|
@ -174,10 +174,10 @@ public class DewVial extends Item {
|
|||
return
|
||||
"You can store excess dew in this tiny vessel for drinking it later. " +
|
||||
"The more full the vial is, the more each dew drop will heal you. " +
|
||||
"A full vial is as strong as a potion of healing." +
|
||||
"\n\nVials like this one used to be imbued with revival magic, " +
|
||||
"but that power has faded. There still seems to be some residual power " +
|
||||
"left, perhaps a full vial can bless another revival item.";
|
||||
"A full vial is as strong as a potion of healing." +
|
||||
"\n\nVials like this one used to be imbued with revival magic, " +
|
||||
"but that power has faded. There still seems to be some residual power " +
|
||||
"left, perhaps a full vial can bless another revival item.";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,84 +26,84 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle
|
|||
|
||||
public abstract class EquipableItem extends Item {
|
||||
|
||||
private static final String TXT_UNEQUIP_CURSED = "You can't remove cursed %s!";
|
||||
private static final String TXT_UNEQUIP_CURSED = "You can't remove cursed %s!";
|
||||
|
||||
public static final String AC_EQUIP = "EQUIP";
|
||||
public static final String AC_UNEQUIP = "UNEQUIP";
|
||||
public static final String AC_EQUIP = "EQUIP";
|
||||
public static final String AC_UNEQUIP = "UNEQUIP";
|
||||
|
||||
{
|
||||
bones = true;
|
||||
}
|
||||
{
|
||||
bones = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute( Hero hero, String action ) {
|
||||
if (action.equals( AC_EQUIP )) {
|
||||
//In addition to equipping itself, item reassigns itself to the quickslot
|
||||
//This is a special case as the item is being removed from inventory, but is staying with the hero.
|
||||
int slot = Dungeon.quickslot.getSlot( this );
|
||||
doEquip(hero);
|
||||
if (slot != -1) {
|
||||
Dungeon.quickslot.setSlot( slot, this );
|
||||
updateQuickslot();
|
||||
}
|
||||
} else if (action.equals( AC_UNEQUIP )) {
|
||||
doUnequip( hero, true );
|
||||
} else {
|
||||
super.execute( hero, action );
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void execute( Hero hero, String action ) {
|
||||
if (action.equals( AC_EQUIP )) {
|
||||
//In addition to equipping itself, item reassigns itself to the quickslot
|
||||
//This is a special case as the item is being removed from inventory, but is staying with the hero.
|
||||
int slot = Dungeon.quickslot.getSlot( this );
|
||||
doEquip(hero);
|
||||
if (slot != -1) {
|
||||
Dungeon.quickslot.setSlot( slot, this );
|
||||
updateQuickslot();
|
||||
}
|
||||
} else if (action.equals( AC_UNEQUIP )) {
|
||||
doUnequip( hero, true );
|
||||
} else {
|
||||
super.execute( hero, action );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doDrop( Hero hero ) {
|
||||
if (!isEquipped( hero ) || doUnequip( hero, false, false )) {
|
||||
super.doDrop( hero );
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void doDrop( Hero hero ) {
|
||||
if (!isEquipped( hero ) || doUnequip( hero, false, false )) {
|
||||
super.doDrop( hero );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cast( final Hero user, int dst ) {
|
||||
@Override
|
||||
public void cast( final Hero user, int dst ) {
|
||||
|
||||
if (isEquipped( user )) {
|
||||
if (quantity == 1 && !this.doUnequip( user, false, false )) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (isEquipped( user )) {
|
||||
if (quantity == 1 && !this.doUnequip( user, false, false )) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
super.cast( user, dst );
|
||||
}
|
||||
super.cast( user, dst );
|
||||
}
|
||||
|
||||
public static void equipCursed( Hero hero ) {
|
||||
hero.sprite.emitter().burst( ShadowParticle.CURSE, 6 );
|
||||
Sample.INSTANCE.play( Assets.SND_CURSED );
|
||||
}
|
||||
public static void equipCursed( Hero hero ) {
|
||||
hero.sprite.emitter().burst( ShadowParticle.CURSE, 6 );
|
||||
Sample.INSTANCE.play( Assets.SND_CURSED );
|
||||
}
|
||||
|
||||
protected float time2equip( Hero hero ) {
|
||||
return 1;
|
||||
}
|
||||
protected float time2equip( Hero hero ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public abstract boolean doEquip( Hero hero );
|
||||
public abstract boolean doEquip( Hero hero );
|
||||
|
||||
public boolean doUnequip( Hero hero, boolean collect, boolean single ) {
|
||||
public boolean doUnequip( Hero hero, boolean collect, boolean single ) {
|
||||
|
||||
if (cursed) {
|
||||
GLog.w(TXT_UNEQUIP_CURSED, name());
|
||||
return false;
|
||||
}
|
||||
if (cursed) {
|
||||
GLog.w(TXT_UNEQUIP_CURSED, name());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (single) {
|
||||
hero.spendAndNext( time2equip( hero ) );
|
||||
} else {
|
||||
hero.spend( time2equip( hero ) );
|
||||
}
|
||||
if (single) {
|
||||
hero.spendAndNext( time2equip( hero ) );
|
||||
} else {
|
||||
hero.spend( time2equip( hero ) );
|
||||
}
|
||||
|
||||
if (collect && !collect( hero.belongings.backpack )) {
|
||||
Dungeon.level.drop( this, hero.pos );
|
||||
}
|
||||
if (collect && !collect( hero.belongings.backpack )) {
|
||||
Dungeon.level.drop( this, hero.pos );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
final public boolean doUnequip( Hero hero, boolean collect ) {
|
||||
return doUnequip( hero, collect, true );
|
||||
}
|
||||
final public boolean doUnequip( Hero hero, boolean collect ) {
|
||||
return doUnequip( hero, collect, true );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class Generator {
|
|||
SCROLL ( 400, Scroll.class ),
|
||||
WAND ( 40, Wand.class ),
|
||||
RING ( 15, Ring.class ),
|
||||
ARTIFACT( 15, Artifact.class),
|
||||
ARTIFACT( 15, Artifact.class),
|
||||
SEED ( 50, Plant.Seed.class ),
|
||||
FOOD ( 0, Food.class ),
|
||||
GOLD ( 500, Gold.class );
|
||||
|
@ -168,35 +168,35 @@ public class Generator {
|
|||
Category.FOOD.probs = new float[]{ 4, 1, 0 };
|
||||
|
||||
Category.RING.classes = new Class<?>[]{
|
||||
RingOfAccuracy.class,
|
||||
RingOfEvasion.class,
|
||||
RingOfElements.class,
|
||||
RingOfForce.class,
|
||||
RingOfFuror.class,
|
||||
RingOfHaste.class,
|
||||
RingOfMagic.class, //currently removed from drop tables, pending rework
|
||||
RingOfMight.class,
|
||||
RingOfSharpshooting.class,
|
||||
RingOfTenacity.class,
|
||||
RingOfWealth.class};
|
||||
RingOfAccuracy.class,
|
||||
RingOfEvasion.class,
|
||||
RingOfElements.class,
|
||||
RingOfForce.class,
|
||||
RingOfFuror.class,
|
||||
RingOfHaste.class,
|
||||
RingOfMagic.class, //currently removed from drop tables, pending rework
|
||||
RingOfMight.class,
|
||||
RingOfSharpshooting.class,
|
||||
RingOfTenacity.class,
|
||||
RingOfWealth.class};
|
||||
Category.RING.probs = new float[]{ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1 };
|
||||
|
||||
Category.ARTIFACT.classes = new Class<?>[]{
|
||||
CapeOfThorns.class,
|
||||
ChaliceOfBlood.class,
|
||||
CloakOfShadows.class,
|
||||
HornOfPlenty.class,
|
||||
MasterThievesArmband.class,
|
||||
SandalsOfNature.class,
|
||||
TalismanOfForesight.class,
|
||||
TimekeepersHourglass.class,
|
||||
UnstableSpellbook.class,
|
||||
AlchemistsToolkit.class, //currently removed from drop tables, pending rework.
|
||||
DriedRose.class, //starts with no chance of spawning, chance is set directly after beating ghost quest.
|
||||
LloydsBeacon.class,
|
||||
EtherealChains.class
|
||||
};
|
||||
Category.ARTIFACT.probs = new float[]{ 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1};
|
||||
Category.ARTIFACT.classes = new Class<?>[]{
|
||||
CapeOfThorns.class,
|
||||
ChaliceOfBlood.class,
|
||||
CloakOfShadows.class,
|
||||
HornOfPlenty.class,
|
||||
MasterThievesArmband.class,
|
||||
SandalsOfNature.class,
|
||||
TalismanOfForesight.class,
|
||||
TimekeepersHourglass.class,
|
||||
UnstableSpellbook.class,
|
||||
AlchemistsToolkit.class, //currently removed from drop tables, pending rework.
|
||||
DriedRose.class, //starts with no chance of spawning, chance is set directly after beating ghost quest.
|
||||
LloydsBeacon.class,
|
||||
EtherealChains.class
|
||||
};
|
||||
Category.ARTIFACT.probs = new float[]{ 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1};
|
||||
|
||||
Category.SEED.classes = new Class<?>[]{
|
||||
Firebloom.Seed.class,
|
||||
|
@ -206,10 +206,10 @@ public class Generator {
|
|||
Sungrass.Seed.class,
|
||||
Earthroot.Seed.class,
|
||||
Fadeleaf.Seed.class,
|
||||
Rotberry.Seed.class,
|
||||
Rotberry.Seed.class,
|
||||
BlandfruitBush.Seed.class,
|
||||
Dreamfoil.Seed.class,
|
||||
Stormvine.Seed.class,
|
||||
Dreamfoil.Seed.class,
|
||||
Stormvine.Seed.class,
|
||||
Starflower.Seed.class};
|
||||
Category.SEED.probs = new float[]{ 12, 12, 12, 12, 12, 12, 12, 0, 4, 12, 12, 1 };
|
||||
}
|
||||
|
@ -234,10 +234,10 @@ public class Generator {
|
|||
return randomArmor();
|
||||
case WEAPON:
|
||||
return randomWeapon();
|
||||
case ARTIFACT:
|
||||
Item item = randomArtifact();
|
||||
//if we're out of artifacts, return a ring instead.
|
||||
return item != null ? item : random(Category.RING);
|
||||
case ARTIFACT:
|
||||
Item item = randomArtifact();
|
||||
//if we're out of artifacts, return a ring instead.
|
||||
return item != null ? item : random(Category.RING);
|
||||
default:
|
||||
return ((Item)cat.classes[Random.chances( cat.probs )].newInstance()).random();
|
||||
}
|
||||
|
@ -261,124 +261,124 @@ public class Generator {
|
|||
}
|
||||
}
|
||||
|
||||
public static Armor randomArmor(){
|
||||
int curStr = Hero.STARTING_STR + Dungeon.limitedDrops.strengthPotions.count;
|
||||
public static Armor randomArmor(){
|
||||
int curStr = Hero.STARTING_STR + Dungeon.limitedDrops.strengthPotions.count;
|
||||
|
||||
return randomArmor(curStr);
|
||||
}
|
||||
return randomArmor(curStr);
|
||||
}
|
||||
|
||||
public static Armor randomArmor(int targetStr) {
|
||||
|
||||
Category cat = Category.ARMOR;
|
||||
|
||||
try {
|
||||
Armor a1 = (Armor) cat.classes[Random.chances(cat.probs)].newInstance();
|
||||
Armor a2 = (Armor) cat.classes[Random.chances(cat.probs)].newInstance();
|
||||
try {
|
||||
Armor a1 = (Armor) cat.classes[Random.chances(cat.probs)].newInstance();
|
||||
Armor a2 = (Armor) cat.classes[Random.chances(cat.probs)].newInstance();
|
||||
|
||||
a1.random();
|
||||
a2.random();
|
||||
a1.random();
|
||||
a2.random();
|
||||
|
||||
return Math.abs(targetStr - a1.STR) < Math.abs(targetStr - a2.STR) ? a1 : a2;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return Math.abs(targetStr - a1.STR) < Math.abs(targetStr - a2.STR) ? a1 : a2;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Weapon randomWeapon(){
|
||||
int curStr = Hero.STARTING_STR + Dungeon.limitedDrops.strengthPotions.count;
|
||||
public static Weapon randomWeapon(){
|
||||
int curStr = Hero.STARTING_STR + Dungeon.limitedDrops.strengthPotions.count;
|
||||
|
||||
return randomWeapon(curStr);
|
||||
}
|
||||
return randomWeapon(curStr);
|
||||
}
|
||||
|
||||
public static Weapon randomWeapon(int targetStr) {
|
||||
|
||||
try {
|
||||
Category cat = Category.WEAPON;
|
||||
try {
|
||||
Category cat = Category.WEAPON;
|
||||
|
||||
Weapon w1 = (Weapon)cat.classes[Random.chances( cat.probs )].newInstance();
|
||||
Weapon w2 = (Weapon)cat.classes[Random.chances( cat.probs )].newInstance();
|
||||
Weapon w1 = (Weapon)cat.classes[Random.chances( cat.probs )].newInstance();
|
||||
Weapon w2 = (Weapon)cat.classes[Random.chances( cat.probs )].newInstance();
|
||||
|
||||
w1.random();
|
||||
w2.random();
|
||||
w1.random();
|
||||
w2.random();
|
||||
|
||||
return Math.abs( targetStr - w1.STR ) < Math.abs( targetStr - w2.STR ) ? w1 : w2;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return Math.abs( targetStr - w1.STR ) < Math.abs( targetStr - w2.STR ) ? w1 : w2;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//enforces uniqueness of artifacts throughout a run.
|
||||
public static Artifact randomArtifact() {
|
||||
//enforces uniqueness of artifacts throughout a run.
|
||||
public static Artifact randomArtifact() {
|
||||
|
||||
try {
|
||||
Category cat = Category.ARTIFACT;
|
||||
int i = Random.chances( cat.probs );
|
||||
try {
|
||||
Category cat = Category.ARTIFACT;
|
||||
int i = Random.chances( cat.probs );
|
||||
|
||||
//if no artifacts are left, return null
|
||||
if (i == -1){
|
||||
return null;
|
||||
}
|
||||
//if no artifacts are left, return null
|
||||
if (i == -1){
|
||||
return null;
|
||||
}
|
||||
|
||||
Artifact artifact = (Artifact)cat.classes[i].newInstance();
|
||||
Artifact artifact = (Artifact)cat.classes[i].newInstance();
|
||||
|
||||
//remove the chance of spawning this artifact.
|
||||
cat.probs[i] = 0;
|
||||
spawnedArtifacts.add(cat.classes[i].getSimpleName());
|
||||
//remove the chance of spawning this artifact.
|
||||
cat.probs[i] = 0;
|
||||
spawnedArtifacts.add(cat.classes[i].getSimpleName());
|
||||
|
||||
artifact.random();
|
||||
artifact.random();
|
||||
|
||||
return artifact;
|
||||
return artifact;
|
||||
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean removeArtifact(Artifact artifact) {
|
||||
if (spawnedArtifacts.contains(artifact.getClass().getSimpleName()))
|
||||
return false;
|
||||
public static boolean removeArtifact(Artifact artifact) {
|
||||
if (spawnedArtifacts.contains(artifact.getClass().getSimpleName()))
|
||||
return false;
|
||||
|
||||
Category cat = Category.ARTIFACT;
|
||||
for (int i = 0; i < cat.classes.length; i++)
|
||||
if (cat.classes[i].equals(artifact.getClass())) {
|
||||
if (cat.probs[i] == 1){
|
||||
Category cat = Category.ARTIFACT;
|
||||
for (int i = 0; i < cat.classes.length; i++)
|
||||
if (cat.classes[i].equals(artifact.getClass())) {
|
||||
if (cat.probs[i] == 1){
|
||||
cat.probs[i] = 0;
|
||||
spawnedArtifacts.add(artifact.getClass().getSimpleName());
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//resets artifact probabilities, for new dungeons
|
||||
public static void initArtifacts() {
|
||||
//FIXME: the duplicated logic here has caused 1 bug so far, should refactor.
|
||||
Category.ARTIFACT.probs = new float[]{ 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1};
|
||||
spawnedArtifacts = new ArrayList<String>();
|
||||
}
|
||||
//resets artifact probabilities, for new dungeons
|
||||
public static void initArtifacts() {
|
||||
//FIXME: the duplicated logic here has caused 1 bug so far, should refactor.
|
||||
Category.ARTIFACT.probs = new float[]{ 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1};
|
||||
spawnedArtifacts = new ArrayList<String>();
|
||||
}
|
||||
|
||||
private static ArrayList<String> spawnedArtifacts = new ArrayList<String>();
|
||||
private static ArrayList<String> spawnedArtifacts = new ArrayList<String>();
|
||||
|
||||
private static final String ARTIFACTS = "artifacts";
|
||||
private static final String ARTIFACTS = "artifacts";
|
||||
|
||||
//used to store information on which artifacts have been spawned.
|
||||
public static void storeInBundle(Bundle bundle) {
|
||||
bundle.put( ARTIFACTS, spawnedArtifacts.toArray(new String[spawnedArtifacts.size()]));
|
||||
}
|
||||
//used to store information on which artifacts have been spawned.
|
||||
public static void storeInBundle(Bundle bundle) {
|
||||
bundle.put( ARTIFACTS, spawnedArtifacts.toArray(new String[spawnedArtifacts.size()]));
|
||||
}
|
||||
|
||||
public static void restoreFromBundle(Bundle bundle) {
|
||||
initArtifacts();
|
||||
public static void restoreFromBundle(Bundle bundle) {
|
||||
initArtifacts();
|
||||
|
||||
if (bundle.contains(ARTIFACTS)) {
|
||||
Collections.addAll(spawnedArtifacts, bundle.getStringArray(ARTIFACTS));
|
||||
Category cat = Category.ARTIFACT;
|
||||
if (bundle.contains(ARTIFACTS)) {
|
||||
Collections.addAll(spawnedArtifacts, bundle.getStringArray(ARTIFACTS));
|
||||
Category cat = Category.ARTIFACT;
|
||||
|
||||
for (String artifact : spawnedArtifacts)
|
||||
for (int i = 0; i < cat.classes.length; i++)
|
||||
if (cat.classes[i].getSimpleName().equals(artifact))
|
||||
cat.probs[i] = 0;
|
||||
}
|
||||
}
|
||||
for (String artifact : spawnedArtifacts)
|
||||
for (int i = 0; i < cat.classes.length; i++)
|
||||
if (cat.classes[i].getSimpleName().equals(artifact))
|
||||
cat.probs[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,9 +66,9 @@ public class Gold extends Item {
|
|||
Statistics.goldCollected += quantity;
|
||||
Badges.validateGoldCollected();
|
||||
|
||||
MasterThievesArmband.Thievery thievery = hero.buff(MasterThievesArmband.Thievery.class);
|
||||
MasterThievesArmband.Thievery thievery = hero.buff(MasterThievesArmband.Thievery.class);
|
||||
if (thievery != null)
|
||||
thievery.collect(quantity);
|
||||
thievery.collect(quantity);
|
||||
|
||||
GameScene.pickUp( this );
|
||||
hero.sprite.showStatus( CharSprite.NEUTRAL, TXT_VALUE, quantity );
|
||||
|
|
|
@ -71,7 +71,7 @@ public class Heap implements Bundlable {
|
|||
CRYSTAL_CHEST,
|
||||
TOMB,
|
||||
SKELETON,
|
||||
REMAINS,
|
||||
REMAINS,
|
||||
MIMIC
|
||||
}
|
||||
public Type type = Type.HEAP;
|
||||
|
@ -98,8 +98,8 @@ public class Heap implements Bundlable {
|
|||
return ItemSpriteSheet.TOMB;
|
||||
case SKELETON:
|
||||
return ItemSpriteSheet.BONES;
|
||||
case REMAINS:
|
||||
return ItemSpriteSheet.REMAINS;
|
||||
case REMAINS:
|
||||
return ItemSpriteSheet.REMAINS;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ public class Heap implements Bundlable {
|
|||
Wraith.spawnAround( hero.pos );
|
||||
break;
|
||||
case SKELETON:
|
||||
case REMAINS:
|
||||
case REMAINS:
|
||||
CellEmitter.center( pos ).start( Speck.factory( Speck.RATTLE ), 0.1f, 3 );
|
||||
for (Item item : items) {
|
||||
if (item.cursed) {
|
||||
|
@ -261,12 +261,12 @@ public class Heap implements Bundlable {
|
|||
//Note: should not be called to initiate an explosion, but rather by an explosion that is happening.
|
||||
public void explode() {
|
||||
|
||||
//breaks open most standard containers, mimics die.
|
||||
//breaks open most standard containers, mimics die.
|
||||
if (type == Type.MIMIC || type == Type.CHEST || type == Type.SKELETON) {
|
||||
type = Type.HEAP;
|
||||
sprite.link();
|
||||
sprite.drop();
|
||||
return;
|
||||
type = Type.HEAP;
|
||||
sprite.link();
|
||||
sprite.drop();
|
||||
return;
|
||||
}
|
||||
|
||||
if (type != Type.HEAP) {
|
||||
|
@ -294,7 +294,7 @@ public class Heap implements Bundlable {
|
|||
}
|
||||
|
||||
if (items.isEmpty())
|
||||
destroy();
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ public class Heap implements Bundlable {
|
|||
replace( item, FrozenCarpaccio.cook( (MysteryMeat)item ) );
|
||||
frozen = true;
|
||||
} else if (item instanceof Potion) {
|
||||
items.remove(item);
|
||||
items.remove(item);
|
||||
((Potion) item).shatter(pos);
|
||||
frozen = true;
|
||||
} else if (item instanceof Bomb){
|
||||
|
@ -345,19 +345,19 @@ public class Heap implements Bundlable {
|
|||
int count = 0;
|
||||
|
||||
|
||||
if (items.size() == 2 && items.get(0) instanceof Seed && items.get(1) instanceof Blandfruit ) {
|
||||
if (items.size() == 2 && items.get(0) instanceof Seed && items.get(1) instanceof Blandfruit ) {
|
||||
|
||||
Sample.INSTANCE.play( Assets.SND_PUFF );
|
||||
CellEmitter.center( pos ).burst( Speck.factory( Speck.EVOKE ), 3 );
|
||||
Sample.INSTANCE.play( Assets.SND_PUFF );
|
||||
CellEmitter.center( pos ).burst( Speck.factory( Speck.EVOKE ), 3 );
|
||||
|
||||
Blandfruit result = new Blandfruit();
|
||||
result.cook((Seed)items.get(0));
|
||||
Blandfruit result = new Blandfruit();
|
||||
result.cook((Seed)items.get(0));
|
||||
|
||||
destroy();
|
||||
destroy();
|
||||
|
||||
return result;
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
for (Item item : items) {
|
||||
|
@ -379,7 +379,7 @@ public class Heap implements Bundlable {
|
|||
CellEmitter.get( pos ).burst( Speck.factory( Speck.WOOL ), 6 );
|
||||
Sample.INSTANCE.play( Assets.SND_PUFF );
|
||||
|
||||
Item potion;
|
||||
Item potion;
|
||||
|
||||
if (Random.Int( count + bonus ) == 0) {
|
||||
|
||||
|
@ -390,7 +390,7 @@ public class Heap implements Bundlable {
|
|||
Statistics.potionsCooked++;
|
||||
Badges.validatePotionsCooked();
|
||||
|
||||
potion = Generator.random( Generator.Category.POTION );
|
||||
potion = Generator.random( Generator.Category.POTION );
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -403,10 +403,10 @@ public class Heap implements Bundlable {
|
|||
Badges.validatePotionsCooked();
|
||||
|
||||
if (itemClass == null) {
|
||||
potion = Generator.random( Generator.Category.POTION );
|
||||
potion = Generator.random( Generator.Category.POTION );
|
||||
} else {
|
||||
try {
|
||||
potion = itemClass.newInstance();
|
||||
potion = itemClass.newInstance();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -418,13 +418,13 @@ public class Heap implements Bundlable {
|
|||
if (Random.Int(1000/bonus) == 0)
|
||||
return new PotionOfExperience();
|
||||
|
||||
while (potion instanceof PotionOfHealing && Random.Int(15) - Dungeon.limitedDrops.cookingHP.count >= 0)
|
||||
potion = Generator.random( Generator.Category.POTION );
|
||||
while (potion instanceof PotionOfHealing && Random.Int(15) - Dungeon.limitedDrops.cookingHP.count >= 0)
|
||||
potion = Generator.random( Generator.Category.POTION );
|
||||
|
||||
if (potion instanceof PotionOfHealing)
|
||||
Dungeon.limitedDrops.cookingHP.count++;
|
||||
if (potion instanceof PotionOfHealing)
|
||||
Dungeon.limitedDrops.cookingHP.count++;
|
||||
|
||||
return potion;
|
||||
return potion;
|
||||
|
||||
} else {
|
||||
return null;
|
||||
|
@ -462,8 +462,8 @@ public class Heap implements Bundlable {
|
|||
public void restoreFromBundle( Bundle bundle ) {
|
||||
pos = bundle.getInt( POS );
|
||||
type = Type.valueOf( bundle.getString( TYPE ) );
|
||||
items = new LinkedList<Item>( (Collection<Item>) ((Collection<?>) bundle.getCollection( ITEMS )) );
|
||||
items.removeAll(Collections.singleton(null));
|
||||
items = new LinkedList<Item>( (Collection<Item>) ((Collection<?>) bundle.getCollection( ITEMS )) );
|
||||
items.removeAll(Collections.singleton(null));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -61,9 +61,9 @@ public class Honeypot extends Item {
|
|||
|
||||
detach( hero.belongings.backpack );
|
||||
|
||||
shatter( hero, hero.pos ).collect();
|
||||
shatter( hero, hero.pos ).collect();
|
||||
|
||||
hero.next();
|
||||
hero.next();
|
||||
|
||||
} else {
|
||||
super.execute( hero, action );
|
||||
|
@ -82,7 +82,7 @@ public class Honeypot extends Item {
|
|||
public Item shatter( Char owner, int pos ) {
|
||||
|
||||
if (Dungeon.visible[pos]) {
|
||||
Sample.INSTANCE.play( Assets.SND_SHATTER );
|
||||
Sample.INSTANCE.play( Assets.SND_SHATTER );
|
||||
Splash.at( pos, 0xffd500, 5 );
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ public class Honeypot extends Item {
|
|||
public Item setBee(Char bee){
|
||||
myBee = bee.id();
|
||||
beeDepth = Dungeon.depth;
|
||||
return this;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -227,20 +227,20 @@ public class Honeypot extends Item {
|
|||
}
|
||||
|
||||
private static final String MYBEE = "mybee";
|
||||
private static final String BEEDEPTH = "beedepth";
|
||||
private static final String BEEDEPTH = "beedepth";
|
||||
|
||||
@Override
|
||||
public void storeInBundle(Bundle bundle) {
|
||||
super.storeInBundle(bundle);
|
||||
bundle.put( MYBEE, myBee );
|
||||
bundle.put( BEEDEPTH, beeDepth );
|
||||
bundle.put( BEEDEPTH, beeDepth );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle(Bundle bundle) {
|
||||
super.restoreFromBundle(bundle);
|
||||
myBee = bundle.getInt( MYBEE );
|
||||
beeDepth = bundle.getInt( BEEDEPTH );
|
||||
beeDepth = bundle.getInt( BEEDEPTH );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,8 +79,8 @@ public class Item implements Bundlable {
|
|||
// Unique items persist through revival
|
||||
public boolean unique = false;
|
||||
|
||||
// whether an item can be included in heroes remains
|
||||
public boolean bones = false;
|
||||
// whether an item can be included in heroes remains
|
||||
public boolean bones = false;
|
||||
|
||||
private static Comparator<Item> itemComparator = new Comparator<Item>() {
|
||||
@Override
|
||||
|
@ -114,11 +114,11 @@ public class Item implements Bundlable {
|
|||
Dungeon.level.drop( detachAll( hero.belongings.backpack ), hero.pos ).sprite.drop( hero.pos );
|
||||
}
|
||||
|
||||
public void syncVisuals(){
|
||||
//do nothing by default, as most items need no visual syncing.
|
||||
}
|
||||
public void syncVisuals(){
|
||||
//do nothing by default, as most items need no visual syncing.
|
||||
}
|
||||
|
||||
public void doThrow( Hero hero ) {
|
||||
public void doThrow( Hero hero ) {
|
||||
GameScene.selectCell( thrower );
|
||||
}
|
||||
|
||||
|
@ -219,15 +219,15 @@ public class Item implements Bundlable {
|
|||
|
||||
try {
|
||||
|
||||
//pssh, who needs copy constructors?
|
||||
Item detached = getClass().newInstance();
|
||||
Bundle copy = new Bundle();
|
||||
this.storeInBundle(copy);
|
||||
detached.restoreFromBundle(copy);
|
||||
detached.quantity(1);
|
||||
//pssh, who needs copy constructors?
|
||||
Item detached = getClass().newInstance();
|
||||
Bundle copy = new Bundle();
|
||||
this.storeInBundle(copy);
|
||||
detached.restoreFromBundle(copy);
|
||||
detached.quantity(1);
|
||||
|
||||
detached.onDetach( );
|
||||
return detached;
|
||||
detached.onDetach( );
|
||||
return detached;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -239,17 +239,17 @@ public class Item implements Bundlable {
|
|||
updateQuickslot();
|
||||
|
||||
for (Item item : container.items) {
|
||||
if (item == this) {
|
||||
container.items.remove(this);
|
||||
item.onDetach();
|
||||
return this;
|
||||
} else if (item instanceof Bag) {
|
||||
Bag bag = (Bag)item;
|
||||
if (bag.contains( this )) {
|
||||
return detachAll( bag );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (item == this) {
|
||||
container.items.remove(this);
|
||||
item.onDetach();
|
||||
return this;
|
||||
} else if (item instanceof Bag) {
|
||||
Bag bag = (Bag)item;
|
||||
if (bag.contains( this )) {
|
||||
return detachAll( bag );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ public class Item implements Bundlable {
|
|||
return getClass() == item.getClass();
|
||||
}
|
||||
|
||||
protected void onDetach(){}
|
||||
protected void onDetach(){}
|
||||
|
||||
public Item upgrade() {
|
||||
|
||||
|
|
|
@ -107,8 +107,8 @@ public class ItemStatusHandler<T extends Item> {
|
|||
known.add( item );
|
||||
}
|
||||
|
||||
//if there's a new item, give it a random image
|
||||
//or.. if we're loading from an untrusted version, randomize the image to be safe.
|
||||
//if there's a new item, give it a random image
|
||||
//or.. if we're loading from an untrusted version, randomize the image to be safe.
|
||||
} else {
|
||||
|
||||
int index = Random.Int( labelsLeft.size() );
|
||||
|
@ -119,9 +119,9 @@ public class ItemStatusHandler<T extends Item> {
|
|||
images.put( item, imagesLeft.get( index ) );
|
||||
imagesLeft.remove( index );
|
||||
|
||||
if (bundle.contains( itemName + PFX_KNOWN ) && bundle.getBoolean( itemName + PFX_KNOWN )) {
|
||||
known.add( item );
|
||||
}
|
||||
if (bundle.contains( itemName + PFX_KNOWN ) && bundle.getBoolean( itemName + PFX_KNOWN )) {
|
||||
known.add( item );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,19 +74,19 @@ public class KindOfWeapon extends EquipableItem {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doUnequip( Hero hero, boolean collect, boolean single ) {
|
||||
if (super.doUnequip( hero, collect, single )) {
|
||||
@Override
|
||||
public boolean doUnequip( Hero hero, boolean collect, boolean single ) {
|
||||
if (super.doUnequip( hero, collect, single )) {
|
||||
|
||||
hero.belongings.weapon = null;
|
||||
return true;
|
||||
hero.belongings.weapon = null;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
return false;
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void activate( Hero hero ) {
|
||||
}
|
||||
|
|
|
@ -3,10 +3,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
|
||||
|
||||
/**
|
||||
* Created by Evan on 24/08/2014.
|
||||
*/
|
||||
public abstract class KindofMisc extends EquipableItem {
|
||||
|
||||
public abstract void activate(Char ch);
|
||||
public abstract void activate(Char ch);
|
||||
}
|
||||
|
|
|
@ -8,9 +8,6 @@ import com.watabou.noosa.audio.Sample;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by debenhame on 16/03/2015.
|
||||
*/
|
||||
public class MerchantsBeacon extends Item {
|
||||
|
||||
private static final String AC_USE = "USE";
|
||||
|
|
|
@ -44,7 +44,7 @@ public class Stylus extends Item {
|
|||
|
||||
stackable = true;
|
||||
|
||||
bones = true;
|
||||
bones = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -36,163 +36,163 @@ import java.util.ArrayList;
|
|||
|
||||
public class Weightstone extends Item {
|
||||
|
||||
private static final String TXT_SELECT_WEAPON = "Select a weapon to balance";
|
||||
private static final String TXT_LIGHT = "you balanced your %s to make it lighter";
|
||||
private static final String TXT_HEAVY = "you balanced your %s to make it heavier";
|
||||
private static final String TXT_SELECT_WEAPON = "Select a weapon to balance";
|
||||
private static final String TXT_LIGHT = "you balanced your %s to make it lighter";
|
||||
private static final String TXT_HEAVY = "you balanced your %s to make it heavier";
|
||||
|
||||
private static final float TIME_TO_APPLY = 2;
|
||||
private static final float TIME_TO_APPLY = 2;
|
||||
|
||||
private static final String AC_APPLY = "APPLY";
|
||||
private static final String AC_APPLY = "APPLY";
|
||||
|
||||
{
|
||||
name = "weightstone";
|
||||
image = ItemSpriteSheet.WEIGHT;
|
||||
{
|
||||
name = "weightstone";
|
||||
image = ItemSpriteSheet.WEIGHT;
|
||||
|
||||
stackable = true;
|
||||
stackable = true;
|
||||
|
||||
bones = true;
|
||||
}
|
||||
bones = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
actions.add( AC_APPLY );
|
||||
return actions;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
actions.add( AC_APPLY );
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute( Hero hero, String action ) {
|
||||
if (action == AC_APPLY) {
|
||||
@Override
|
||||
public void execute( Hero hero, String action ) {
|
||||
if (action == AC_APPLY) {
|
||||
|
||||
curUser = hero;
|
||||
GameScene.selectItem( itemSelector, WndBag.Mode.WEAPON, TXT_SELECT_WEAPON );
|
||||
curUser = hero;
|
||||
GameScene.selectItem( itemSelector, WndBag.Mode.WEAPON, TXT_SELECT_WEAPON );
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
super.execute( hero, action );
|
||||
super.execute( hero, action );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUpgradable() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isUpgradable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIdentified() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isIdentified() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void apply( Weapon weapon, boolean forSpeed ) {
|
||||
private void apply( Weapon weapon, boolean forSpeed ) {
|
||||
|
||||
detach( curUser.belongings.backpack );
|
||||
detach( curUser.belongings.backpack );
|
||||
|
||||
if (forSpeed) {
|
||||
weapon.imbue = Weapon.Imbue.LIGHT;
|
||||
GLog.p( TXT_LIGHT, weapon.name() );
|
||||
} else {
|
||||
weapon.imbue = Weapon.Imbue.HEAVY;
|
||||
GLog.p( TXT_HEAVY, weapon.name() );
|
||||
}
|
||||
if (forSpeed) {
|
||||
weapon.imbue = Weapon.Imbue.LIGHT;
|
||||
GLog.p( TXT_LIGHT, weapon.name() );
|
||||
} else {
|
||||
weapon.imbue = Weapon.Imbue.HEAVY;
|
||||
GLog.p( TXT_HEAVY, weapon.name() );
|
||||
}
|
||||
|
||||
curUser.sprite.operate( curUser.pos );
|
||||
Sample.INSTANCE.play( Assets.SND_MISS );
|
||||
curUser.sprite.operate( curUser.pos );
|
||||
Sample.INSTANCE.play( Assets.SND_MISS );
|
||||
|
||||
curUser.spend( TIME_TO_APPLY );
|
||||
curUser.busy();
|
||||
}
|
||||
curUser.spend( TIME_TO_APPLY );
|
||||
curUser.busy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int price() {
|
||||
return 40 * quantity;
|
||||
}
|
||||
@Override
|
||||
public int price() {
|
||||
return 40 * quantity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String info() {
|
||||
return
|
||||
"Using a weightstone, you can balance your melee weapon to make it lighter or heavier, " +
|
||||
"increasing either speed or damage at the expense of the other.";
|
||||
}
|
||||
@Override
|
||||
public String info() {
|
||||
return
|
||||
"Using a weightstone, you can balance your melee weapon to make it lighter or heavier, " +
|
||||
"increasing either speed or damage at the expense of the other.";
|
||||
}
|
||||
|
||||
private final WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||
@Override
|
||||
public void onSelect( Item item ) {
|
||||
if (item != null) {
|
||||
GameScene.show( new WndBalance( (Weapon)item ) );
|
||||
}
|
||||
}
|
||||
};
|
||||
private final WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||
@Override
|
||||
public void onSelect( Item item ) {
|
||||
if (item != null) {
|
||||
GameScene.show( new WndBalance( (Weapon)item ) );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public class WndBalance extends Window {
|
||||
public class WndBalance extends Window {
|
||||
|
||||
private static final String TXT_CHOICE = "How would you like to balance your %s?";
|
||||
private static final String TXT_CHOICE = "How would you like to balance your %s?";
|
||||
|
||||
private static final String TXT_LIGHT = "Lighter";
|
||||
private static final String TXT_HEAVY = "Heavier";
|
||||
private static final String TXT_CANCEL = "Never mind";
|
||||
private static final String TXT_LIGHT = "Lighter";
|
||||
private static final String TXT_HEAVY = "Heavier";
|
||||
private static final String TXT_CANCEL = "Never mind";
|
||||
|
||||
private static final int WIDTH = 120;
|
||||
private static final int MARGIN = 2;
|
||||
private static final int BUTTON_WIDTH = WIDTH - MARGIN * 2;
|
||||
private static final int BUTTON_HEIGHT = 20;
|
||||
private static final int WIDTH = 120;
|
||||
private static final int MARGIN = 2;
|
||||
private static final int BUTTON_WIDTH = WIDTH - MARGIN * 2;
|
||||
private static final int BUTTON_HEIGHT = 20;
|
||||
|
||||
public WndBalance( final Weapon weapon ) {
|
||||
super();
|
||||
public WndBalance( final Weapon weapon ) {
|
||||
super();
|
||||
|
||||
IconTitle titlebar = new IconTitle( weapon );
|
||||
titlebar.setRect( 0, 0, WIDTH, 0 );
|
||||
add( titlebar );
|
||||
IconTitle titlebar = new IconTitle( weapon );
|
||||
titlebar.setRect( 0, 0, WIDTH, 0 );
|
||||
add( titlebar );
|
||||
|
||||
BitmapTextMultiline tfMesage = PixelScene.createMultiline( Utils.format( TXT_CHOICE, weapon.name() ), 8 );
|
||||
tfMesage.maxWidth = WIDTH - MARGIN * 2;
|
||||
tfMesage.measure();
|
||||
tfMesage.x = MARGIN;
|
||||
tfMesage.y = titlebar.bottom() + MARGIN;
|
||||
add( tfMesage );
|
||||
BitmapTextMultiline tfMesage = PixelScene.createMultiline( Utils.format( TXT_CHOICE, weapon.name() ), 8 );
|
||||
tfMesage.maxWidth = WIDTH - MARGIN * 2;
|
||||
tfMesage.measure();
|
||||
tfMesage.x = MARGIN;
|
||||
tfMesage.y = titlebar.bottom() + MARGIN;
|
||||
add( tfMesage );
|
||||
|
||||
float pos = tfMesage.y + tfMesage.height();
|
||||
float pos = tfMesage.y + tfMesage.height();
|
||||
|
||||
if (weapon.imbue != Weapon.Imbue.LIGHT) {
|
||||
RedButton btnSpeed = new RedButton( TXT_LIGHT ) {
|
||||
@Override
|
||||
protected void onClick() {
|
||||
hide();
|
||||
Weightstone.this.apply( weapon, true );
|
||||
}
|
||||
};
|
||||
btnSpeed.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
|
||||
add( btnSpeed );
|
||||
if (weapon.imbue != Weapon.Imbue.LIGHT) {
|
||||
RedButton btnSpeed = new RedButton( TXT_LIGHT ) {
|
||||
@Override
|
||||
protected void onClick() {
|
||||
hide();
|
||||
Weightstone.this.apply( weapon, true );
|
||||
}
|
||||
};
|
||||
btnSpeed.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
|
||||
add( btnSpeed );
|
||||
|
||||
pos = btnSpeed.bottom();
|
||||
}
|
||||
pos = btnSpeed.bottom();
|
||||
}
|
||||
|
||||
if (weapon.imbue != Weapon.Imbue.HEAVY) {
|
||||
RedButton btnAccuracy = new RedButton( TXT_HEAVY ) {
|
||||
@Override
|
||||
protected void onClick() {
|
||||
hide();
|
||||
Weightstone.this.apply( weapon, false );
|
||||
}
|
||||
};
|
||||
btnAccuracy.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
|
||||
add( btnAccuracy );
|
||||
if (weapon.imbue != Weapon.Imbue.HEAVY) {
|
||||
RedButton btnAccuracy = new RedButton( TXT_HEAVY ) {
|
||||
@Override
|
||||
protected void onClick() {
|
||||
hide();
|
||||
Weightstone.this.apply( weapon, false );
|
||||
}
|
||||
};
|
||||
btnAccuracy.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
|
||||
add( btnAccuracy );
|
||||
|
||||
pos = btnAccuracy.bottom();
|
||||
}
|
||||
pos = btnAccuracy.bottom();
|
||||
}
|
||||
|
||||
RedButton btnCancel = new RedButton( TXT_CANCEL ) {
|
||||
@Override
|
||||
protected void onClick() {
|
||||
hide();
|
||||
}
|
||||
};
|
||||
btnCancel.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
|
||||
add( btnCancel );
|
||||
RedButton btnCancel = new RedButton( TXT_CANCEL ) {
|
||||
@Override
|
||||
protected void onClick() {
|
||||
hide();
|
||||
}
|
||||
};
|
||||
btnCancel.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
|
||||
add( btnCancel );
|
||||
|
||||
resize( WIDTH, (int)btnCancel.bottom() + MARGIN );
|
||||
}
|
||||
resize( WIDTH, (int)btnCancel.bottom() + MARGIN );
|
||||
}
|
||||
|
||||
protected void onSelect( int index ) {};
|
||||
}
|
||||
protected void onSelect( int index ) {};
|
||||
}
|
||||
}
|
|
@ -107,7 +107,7 @@ public class Armor extends EquipableItem {
|
|||
|
||||
((HeroSprite)hero.sprite).updateArmor();
|
||||
|
||||
hero.spendAndNext( 2 * time2equip( hero ) );
|
||||
hero.spendAndNext( 2 * time2equip( hero ) );
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
@ -118,26 +118,26 @@ public class Armor extends EquipableItem {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float time2equip( Hero hero ) {
|
||||
return hero.speed();
|
||||
}
|
||||
@Override
|
||||
protected float time2equip( Hero hero ) {
|
||||
return hero.speed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doUnequip( Hero hero, boolean collect, boolean single ) {
|
||||
if (super.doUnequip( hero, collect, single )) {
|
||||
@Override
|
||||
public boolean doUnequip( Hero hero, boolean collect, boolean single ) {
|
||||
if (super.doUnequip( hero, collect, single )) {
|
||||
|
||||
hero.belongings.armor = null;
|
||||
((HeroSprite)hero.sprite).updateArmor();
|
||||
hero.belongings.armor = null;
|
||||
((HeroSprite)hero.sprite).updateArmor();
|
||||
|
||||
return true;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
return false;
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEquipped( Hero hero ) {
|
||||
|
@ -306,18 +306,18 @@ public class Armor extends EquipableItem {
|
|||
return price;
|
||||
}
|
||||
|
||||
public Armor inscribe( Glyph glyph ) {
|
||||
public Armor inscribe( Glyph glyph ) {
|
||||
|
||||
if (glyph != null && this.glyph == null) {
|
||||
DR += tier;
|
||||
} else if (glyph == null && this.glyph != null) {
|
||||
DR -= tier;
|
||||
}
|
||||
if (glyph != null && this.glyph == null) {
|
||||
DR += tier;
|
||||
} else if (glyph == null && this.glyph != null) {
|
||||
DR -= tier;
|
||||
}
|
||||
|
||||
this.glyph = glyph;
|
||||
this.glyph = glyph;
|
||||
|
||||
return this;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Armor inscribe() {
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ abstract public class ClassArmor extends Armor {
|
|||
cursedKnown = true;
|
||||
defaultAction = special();
|
||||
|
||||
bones = false;
|
||||
bones = false;
|
||||
}
|
||||
|
||||
public ClassArmor() {
|
||||
|
|
|
@ -26,7 +26,7 @@ public class ClothArmor extends Armor {
|
|||
name = "cloth armor";
|
||||
image = ItemSpriteSheet.ARMOR_CLOTH;
|
||||
|
||||
bones = false; //Finding them in bones would be semi-frequent and disappointing.
|
||||
bones = false; //Finding them in bones would be semi-frequent and disappointing.
|
||||
}
|
||||
|
||||
public ClothArmor() {
|
||||
|
|
|
@ -65,7 +65,7 @@ public class MageArmor extends ClassArmor {
|
|||
}
|
||||
}
|
||||
|
||||
curUser.HP -= (curUser.HP / 3);
|
||||
curUser.HP -= (curUser.HP / 3);
|
||||
|
||||
curUser.spend( Actor.TICK );
|
||||
curUser.sprite.operate( curUser.pos );
|
||||
|
|
|
@ -88,7 +88,7 @@ public class RogueArmor extends ClassArmor {
|
|||
return;
|
||||
}
|
||||
|
||||
curUser.HP -= (curUser.HP / 3);
|
||||
curUser.HP -= (curUser.HP / 3);
|
||||
|
||||
for (Mob mob : Dungeon.level.mobs) {
|
||||
if (Level.fieldOfView[mob.pos]) {
|
||||
|
|
|
@ -91,35 +91,35 @@ public class WarriorArmor extends ClassArmor {
|
|||
cell = route.path.get(route.dist-1);
|
||||
|
||||
|
||||
curUser.HP -= (curUser.HP / 3);
|
||||
curUser.HP -= (curUser.HP / 3);
|
||||
if (curUser.subClass == HeroSubClass.BERSERKER && curUser.HP <= curUser.HT * Fury.LEVEL) {
|
||||
Buff.affect( curUser, Fury.class );
|
||||
}
|
||||
|
||||
|
||||
|
||||
final int dest = cell;
|
||||
curUser.busy();
|
||||
curUser.sprite.jump(curUser.pos, cell, new Callback() {
|
||||
@Override
|
||||
public void call() {
|
||||
curUser.move(dest);
|
||||
Dungeon.level.press(dest, curUser);
|
||||
Dungeon.observe();
|
||||
final int dest = cell;
|
||||
curUser.busy();
|
||||
curUser.sprite.jump(curUser.pos, cell, new Callback() {
|
||||
@Override
|
||||
public void call() {
|
||||
curUser.move(dest);
|
||||
Dungeon.level.press(dest, curUser);
|
||||
Dungeon.observe();
|
||||
|
||||
for (int i = 0; i < Level.NEIGHBOURS8.length; i++) {
|
||||
Char mob = Actor.findChar(curUser.pos + Level.NEIGHBOURS8[i]);
|
||||
if (mob != null && mob != curUser) {
|
||||
Buff.prolong(mob, Paralysis.class, SHOCK_TIME);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < Level.NEIGHBOURS8.length; i++) {
|
||||
Char mob = Actor.findChar(curUser.pos + Level.NEIGHBOURS8[i]);
|
||||
if (mob != null && mob != curUser) {
|
||||
Buff.prolong(mob, Paralysis.class, SHOCK_TIME);
|
||||
}
|
||||
}
|
||||
|
||||
CellEmitter.center(dest).burst(Speck.factory(Speck.DUST), 10);
|
||||
Camera.main.shake(2, 0.5f);
|
||||
CellEmitter.center(dest).burst(Speck.factory(Speck.DUST), 10);
|
||||
Camera.main.shake(2, 0.5f);
|
||||
|
||||
curUser.spendAndNext(LEAP_TIME);
|
||||
}
|
||||
});
|
||||
curUser.spendAndNext(LEAP_TIME);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,254 +17,251 @@ import com.watabou.utils.Random;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* Created by debenhame on 24/11/2014.
|
||||
*/
|
||||
public class AlchemistsToolkit extends Artifact {
|
||||
|
||||
{
|
||||
name = "Alchemists Toolkit";
|
||||
image = ItemSpriteSheet.ARTIFACT_TOOLKIT;
|
||||
{
|
||||
name = "Alchemists Toolkit";
|
||||
image = ItemSpriteSheet.ARTIFACT_TOOLKIT;
|
||||
|
||||
level = 0;
|
||||
levelCap = 10;
|
||||
}
|
||||
level = 0;
|
||||
levelCap = 10;
|
||||
}
|
||||
|
||||
public static final String AC_BREW = "BREW";
|
||||
public static final String AC_BREW = "BREW";
|
||||
|
||||
//arrays used in containing potion collections for mix logic.
|
||||
public final ArrayList<String> combination = new ArrayList<String>();
|
||||
public ArrayList<String> curGuess = new ArrayList<String>();
|
||||
public ArrayList<String> bstGuess = new ArrayList<String>();
|
||||
//arrays used in containing potion collections for mix logic.
|
||||
public final ArrayList<String> combination = new ArrayList<String>();
|
||||
public ArrayList<String> curGuess = new ArrayList<String>();
|
||||
public ArrayList<String> bstGuess = new ArrayList<String>();
|
||||
|
||||
public int numWrongPlace = 0;
|
||||
public int numRight = 0;
|
||||
public int numWrongPlace = 0;
|
||||
public int numRight = 0;
|
||||
|
||||
private int seedsToPotion = 0;
|
||||
private int seedsToPotion = 0;
|
||||
|
||||
protected String inventoryTitle = "Select a potion";
|
||||
protected WndBag.Mode mode = WndBag.Mode.POTION;
|
||||
protected String inventoryTitle = "Select a potion";
|
||||
protected WndBag.Mode mode = WndBag.Mode.POTION;
|
||||
|
||||
public AlchemistsToolkit() {
|
||||
super();
|
||||
public AlchemistsToolkit() {
|
||||
super();
|
||||
|
||||
Generator.Category cat = Generator.Category.POTION;
|
||||
for (int i = 1; i <= 3; i++){
|
||||
String potion;
|
||||
do{
|
||||
potion = convertName(cat.classes[Random.chances(cat.probs)].getSimpleName());
|
||||
//forcing the player to use experience potions would be completely unfair.
|
||||
} while (combination.contains(potion) || potion.equals("Experience"));
|
||||
combination.add(potion);
|
||||
}
|
||||
}
|
||||
Generator.Category cat = Generator.Category.POTION;
|
||||
for (int i = 1; i <= 3; i++){
|
||||
String potion;
|
||||
do{
|
||||
potion = convertName(cat.classes[Random.chances(cat.probs)].getSimpleName());
|
||||
//forcing the player to use experience potions would be completely unfair.
|
||||
} while (combination.contains(potion) || potion.equals("Experience"));
|
||||
combination.add(potion);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
if (isEquipped( hero ) && level < levelCap && !cursed)
|
||||
actions.add(AC_BREW);
|
||||
return actions;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
if (isEquipped( hero ) && level < levelCap && !cursed)
|
||||
actions.add(AC_BREW);
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Hero hero, String action ) {
|
||||
if (action.equals(AC_BREW)){
|
||||
GameScene.selectItem(itemSelector, mode, inventoryTitle);
|
||||
} else {
|
||||
super.execute(hero, action);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void execute(Hero hero, String action ) {
|
||||
if (action.equals(AC_BREW)){
|
||||
GameScene.selectItem(itemSelector, mode, inventoryTitle);
|
||||
} else {
|
||||
super.execute(hero, action);
|
||||
}
|
||||
}
|
||||
|
||||
public void guessBrew() {
|
||||
if (curGuess.size() != 3)
|
||||
return;
|
||||
public void guessBrew() {
|
||||
if (curGuess.size() != 3)
|
||||
return;
|
||||
|
||||
int numWrongPlace = 0;
|
||||
int numRight = 0;
|
||||
int numWrongPlace = 0;
|
||||
int numRight = 0;
|
||||
|
||||
for (String potion : curGuess) {
|
||||
if (combination.contains(potion)) {
|
||||
if (curGuess.indexOf(potion) == combination.indexOf(potion)) {
|
||||
numRight++;
|
||||
} else {
|
||||
numWrongPlace++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String potion : curGuess) {
|
||||
if (combination.contains(potion)) {
|
||||
if (curGuess.indexOf(potion) == combination.indexOf(potion)) {
|
||||
numRight++;
|
||||
} else {
|
||||
numWrongPlace++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int score = (numRight *3) + numWrongPlace;
|
||||
int score = (numRight *3) + numWrongPlace;
|
||||
|
||||
if (score == 9)
|
||||
score ++;
|
||||
if (score == 9)
|
||||
score ++;
|
||||
|
||||
if (score == 0){
|
||||
if (score == 0){
|
||||
|
||||
GLog.i("Your mixture is complete, but none of the potions you used seem to react well. " +
|
||||
"The brew is useless, you throw it away.");
|
||||
GLog.i("Your mixture is complete, but none of the potions you used seem to react well. " +
|
||||
"The brew is useless, you throw it away.");
|
||||
|
||||
} else if (score > level) {
|
||||
} else if (score > level) {
|
||||
|
||||
level = score;
|
||||
seedsToPotion = 0;
|
||||
bstGuess = curGuess;
|
||||
this.numRight = numRight;
|
||||
this.numWrongPlace = numWrongPlace;
|
||||
level = score;
|
||||
seedsToPotion = 0;
|
||||
bstGuess = curGuess;
|
||||
this.numRight = numRight;
|
||||
this.numWrongPlace = numWrongPlace;
|
||||
|
||||
if (level == 10){
|
||||
bstGuess = new ArrayList<String>();
|
||||
GLog.p("The mixture you've created seems perfect, you don't think there is any way to improve it!");
|
||||
} else {
|
||||
GLog.w("you finish mixing potions, " + brewDesc(numWrongPlace, numRight) +
|
||||
". This is your best brew yet!");
|
||||
}
|
||||
if (level == 10){
|
||||
bstGuess = new ArrayList<String>();
|
||||
GLog.p("The mixture you've created seems perfect, you don't think there is any way to improve it!");
|
||||
} else {
|
||||
GLog.w("you finish mixing potions, " + brewDesc(numWrongPlace, numRight) +
|
||||
". This is your best brew yet!");
|
||||
}
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
GLog.w("you finish mixing potions, " + brewDesc(numWrongPlace, numRight) +
|
||||
". This brew isn't as good as the current one, you throw it away.");
|
||||
}
|
||||
curGuess = new ArrayList<String>();
|
||||
GLog.w("you finish mixing potions, " + brewDesc(numWrongPlace, numRight) +
|
||||
". This brew isn't as good as the current one, you throw it away.");
|
||||
}
|
||||
curGuess = new ArrayList<String>();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private String brewDesc(int numWrongPlace, int numRight){
|
||||
String result = "";
|
||||
if (numWrongPlace > 0){
|
||||
result += numWrongPlace + " reacted well, but in the wrong order";
|
||||
if (numRight > 0)
|
||||
result += " and ";
|
||||
}
|
||||
if (numRight > 0){
|
||||
result += numRight + " reacted perfectly";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private String brewDesc(int numWrongPlace, int numRight){
|
||||
String result = "";
|
||||
if (numWrongPlace > 0){
|
||||
result += numWrongPlace + " reacted well, but in the wrong order";
|
||||
if (numRight > 0)
|
||||
result += " and ";
|
||||
}
|
||||
if (numRight > 0){
|
||||
result += numRight + " reacted perfectly";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ArtifactBuff passiveBuff() {
|
||||
return new alchemy();
|
||||
}
|
||||
@Override
|
||||
protected ArtifactBuff passiveBuff() {
|
||||
return new alchemy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
String result = "This toolkit contains a number of regents and herbs used to improve the process of " +
|
||||
"cooking potions.\n\n";
|
||||
@Override
|
||||
public String desc() {
|
||||
String result = "This toolkit contains a number of regents and herbs used to improve the process of " +
|
||||
"cooking potions.\n\n";
|
||||
|
||||
if (isEquipped(Dungeon.hero))
|
||||
if (cursed)
|
||||
result += "The cursed toolkit has bound itself to your side, and refuses to let you use alchemy.\n\n";
|
||||
else
|
||||
result += "The toolkit rests on your hip, the various tools inside make a light jingling sound as you move.\n\n";
|
||||
if (isEquipped(Dungeon.hero))
|
||||
if (cursed)
|
||||
result += "The cursed toolkit has bound itself to your side, and refuses to let you use alchemy.\n\n";
|
||||
else
|
||||
result += "The toolkit rests on your hip, the various tools inside make a light jingling sound as you move.\n\n";
|
||||
|
||||
if (level == 0){
|
||||
result += "The toolkit seems to be missing a key tool, a catalyst mixture. You'll have to make your own " +
|
||||
"out of three common potions to get the most out of the toolkit.";
|
||||
} else if (level == 10) {
|
||||
result += "The mixture you have created seems perfect, and the toolkit is working at maximum efficiency.";
|
||||
} else if (!bstGuess.isEmpty()) {
|
||||
result += "Your current best mixture is made from: " + bstGuess.get(0) + ", " + bstGuess.get(1) + ", "
|
||||
+ bstGuess.get(2) + ", in that order.\n\n";
|
||||
result += "Of the potions in that mix, " + brewDesc(numWrongPlace, numRight) + ".";
|
||||
if (level == 0){
|
||||
result += "The toolkit seems to be missing a key tool, a catalyst mixture. You'll have to make your own " +
|
||||
"out of three common potions to get the most out of the toolkit.";
|
||||
} else if (level == 10) {
|
||||
result += "The mixture you have created seems perfect, and the toolkit is working at maximum efficiency.";
|
||||
} else if (!bstGuess.isEmpty()) {
|
||||
result += "Your current best mixture is made from: " + bstGuess.get(0) + ", " + bstGuess.get(1) + ", "
|
||||
+ bstGuess.get(2) + ", in that order.\n\n";
|
||||
result += "Of the potions in that mix, " + brewDesc(numWrongPlace, numRight) + ".";
|
||||
|
||||
//would only trigger if an upgraded toolkit was gained through transmutation or bones.
|
||||
} else {
|
||||
result += "The toolkit seems to have a catalyst mixture already in it, but it isn't ideal. Unfortunately " +
|
||||
"you have no idea what's in the mixture.";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
//would only trigger if an upgraded toolkit was gained through transmutation or bones.
|
||||
} else {
|
||||
result += "The toolkit seems to have a catalyst mixture already in it, but it isn't ideal. Unfortunately " +
|
||||
"you have no idea what's in the mixture.";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static final String COMBINATION = "combination";
|
||||
private static final String CURGUESS = "curguess";
|
||||
private static final String BSTGUESS = "bstguess";
|
||||
private static final String COMBINATION = "combination";
|
||||
private static final String CURGUESS = "curguess";
|
||||
private static final String BSTGUESS = "bstguess";
|
||||
|
||||
private static final String NUMWRONGPLACE = "numwrongplace";
|
||||
private static final String NUMRIGHT = "numright";
|
||||
private static final String NUMWRONGPLACE = "numwrongplace";
|
||||
private static final String NUMRIGHT = "numright";
|
||||
|
||||
private static final String SEEDSTOPOTION = "seedstopotion";
|
||||
private static final String SEEDSTOPOTION = "seedstopotion";
|
||||
|
||||
@Override
|
||||
public void storeInBundle(Bundle bundle){
|
||||
super.storeInBundle(bundle);
|
||||
bundle.put(NUMWRONGPLACE, numWrongPlace);
|
||||
bundle.put(NUMRIGHT, numRight);
|
||||
@Override
|
||||
public void storeInBundle(Bundle bundle){
|
||||
super.storeInBundle(bundle);
|
||||
bundle.put(NUMWRONGPLACE, numWrongPlace);
|
||||
bundle.put(NUMRIGHT, numRight);
|
||||
|
||||
bundle.put(SEEDSTOPOTION, seedsToPotion);
|
||||
bundle.put(SEEDSTOPOTION, seedsToPotion);
|
||||
|
||||
bundle.put(COMBINATION, combination.toArray(new String[combination.size()]));
|
||||
bundle.put(CURGUESS, curGuess.toArray(new String[curGuess.size()]));
|
||||
bundle.put(BSTGUESS, bstGuess.toArray(new String[bstGuess.size()]));
|
||||
}
|
||||
bundle.put(COMBINATION, combination.toArray(new String[combination.size()]));
|
||||
bundle.put(CURGUESS, curGuess.toArray(new String[curGuess.size()]));
|
||||
bundle.put(BSTGUESS, bstGuess.toArray(new String[bstGuess.size()]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle(bundle);
|
||||
numWrongPlace = bundle.getInt( NUMWRONGPLACE );
|
||||
numRight = bundle.getInt( NUMRIGHT );
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle(bundle);
|
||||
numWrongPlace = bundle.getInt( NUMWRONGPLACE );
|
||||
numRight = bundle.getInt( NUMRIGHT );
|
||||
|
||||
seedsToPotion = bundle.getInt( SEEDSTOPOTION );
|
||||
seedsToPotion = bundle.getInt( SEEDSTOPOTION );
|
||||
|
||||
combination.clear();
|
||||
Collections.addAll( combination, bundle.getStringArray( COMBINATION ));
|
||||
Collections.addAll( curGuess, bundle.getStringArray( CURGUESS ));
|
||||
Collections.addAll( bstGuess, bundle.getStringArray( BSTGUESS ));
|
||||
}
|
||||
combination.clear();
|
||||
Collections.addAll( combination, bundle.getStringArray( COMBINATION ));
|
||||
Collections.addAll( curGuess, bundle.getStringArray( CURGUESS ));
|
||||
Collections.addAll( bstGuess, bundle.getStringArray( BSTGUESS ));
|
||||
}
|
||||
|
||||
|
||||
public class alchemy extends ArtifactBuff {
|
||||
public class alchemy extends ArtifactBuff {
|
||||
|
||||
public boolean tryCook(int count){
|
||||
public boolean tryCook(int count){
|
||||
|
||||
//this logic is handled inside the class with a variable so that it may be stored.
|
||||
//to prevent manipulation where a player could keep throwing in 1-2 seeds until they get lucky.
|
||||
if (seedsToPotion == 0){
|
||||
if (Random.Int(20) < 10+level){
|
||||
if (Random.Int(20) < level){
|
||||
seedsToPotion = 1;
|
||||
} else
|
||||
seedsToPotion = 2;
|
||||
} else
|
||||
seedsToPotion = 3;
|
||||
}
|
||||
//this logic is handled inside the class with a variable so that it may be stored.
|
||||
//to prevent manipulation where a player could keep throwing in 1-2 seeds until they get lucky.
|
||||
if (seedsToPotion == 0){
|
||||
if (Random.Int(20) < 10+level){
|
||||
if (Random.Int(20) < level){
|
||||
seedsToPotion = 1;
|
||||
} else
|
||||
seedsToPotion = 2;
|
||||
} else
|
||||
seedsToPotion = 3;
|
||||
}
|
||||
|
||||
if (count >= seedsToPotion){
|
||||
seedsToPotion = 0;
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
if (count >= seedsToPotion){
|
||||
seedsToPotion = 0;
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||
@Override
|
||||
public void onSelect(Item item) {
|
||||
if (item != null && item instanceof Potion && item.isIdentified()){
|
||||
if (!curGuess.contains(convertName(item.getClass().getSimpleName()))) {
|
||||
protected WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||
@Override
|
||||
public void onSelect(Item item) {
|
||||
if (item != null && item instanceof Potion && item.isIdentified()){
|
||||
if (!curGuess.contains(convertName(item.getClass().getSimpleName()))) {
|
||||
|
||||
Hero hero = Dungeon.hero;
|
||||
hero.sprite.operate( hero.pos );
|
||||
hero.busy();
|
||||
hero.spend( 2f );
|
||||
Sample.INSTANCE.play(Assets.SND_DRINK);
|
||||
Hero hero = Dungeon.hero;
|
||||
hero.sprite.operate( hero.pos );
|
||||
hero.busy();
|
||||
hero.spend( 2f );
|
||||
Sample.INSTANCE.play(Assets.SND_DRINK);
|
||||
|
||||
item.detach(hero.belongings.backpack);
|
||||
item.detach(hero.belongings.backpack);
|
||||
|
||||
curGuess.add(convertName(item.getClass().getSimpleName()));
|
||||
if (curGuess.size() == 3){
|
||||
guessBrew();
|
||||
} else {
|
||||
GLog.i("You mix the " + item.name() + " into your current brew.");
|
||||
}
|
||||
} else {
|
||||
GLog.w("Your current brew already contains that potion.");
|
||||
}
|
||||
} else if (item != null) {
|
||||
GLog.w("You need to select an identified potion.");
|
||||
}
|
||||
}
|
||||
};
|
||||
curGuess.add(convertName(item.getClass().getSimpleName()));
|
||||
if (curGuess.size() == 3){
|
||||
guessBrew();
|
||||
} else {
|
||||
GLog.i("You mix the " + item.name() + " into your current brew.");
|
||||
}
|
||||
} else {
|
||||
GLog.w("Your current brew already contains that potion.");
|
||||
}
|
||||
} else if (item != null) {
|
||||
GLog.w("You need to select an identified potion.");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -13,270 +13,267 @@ import com.watabou.utils.Random;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by Evan on 24/08/2014.
|
||||
*/
|
||||
public class Artifact extends KindofMisc {
|
||||
|
||||
private static final float TIME_TO_EQUIP = 1f;
|
||||
private static final float TIME_TO_EQUIP = 1f;
|
||||
|
||||
private static final String TXT_TO_STRING = "%s";
|
||||
private static final String TXT_TO_STRING_CHARGE = "%s (%d/%d)";
|
||||
private static final String TXT_TO_STRING_LVL = "%s%+d";
|
||||
private static final String TXT_TO_STRING_LVL_CHARGE = "%s%+d (%d/%d)";
|
||||
private static final String TXT_TO_STRING = "%s";
|
||||
private static final String TXT_TO_STRING_CHARGE = "%s (%d/%d)";
|
||||
private static final String TXT_TO_STRING_LVL = "%s%+d";
|
||||
private static final String TXT_TO_STRING_LVL_CHARGE = "%s%+d (%d/%d)";
|
||||
|
||||
protected Buff passiveBuff;
|
||||
protected Buff activeBuff;
|
||||
protected Buff passiveBuff;
|
||||
protected Buff activeBuff;
|
||||
|
||||
//level is used internally to track upgrades to artifacts, size/logic varies per artifact.
|
||||
//already inherited from item superclass
|
||||
//exp is used to count progress towards levels for some artifacts
|
||||
protected int exp = 0;
|
||||
//levelCap is the artifact's maximum level
|
||||
protected int levelCap = 0;
|
||||
//level is used internally to track upgrades to artifacts, size/logic varies per artifact.
|
||||
//already inherited from item superclass
|
||||
//exp is used to count progress towards levels for some artifacts
|
||||
protected int exp = 0;
|
||||
//levelCap is the artifact's maximum level
|
||||
protected int levelCap = 0;
|
||||
|
||||
//the current artifact charge
|
||||
protected int charge = 0;
|
||||
//the build towards next charge, usually rolls over at 1.
|
||||
//better to keep charge as an int and use a separate float than casting.
|
||||
protected float partialCharge = 0;
|
||||
//the maximum charge, varies per artifact, not all artifacts use this.
|
||||
protected int chargeCap = 0;
|
||||
//the current artifact charge
|
||||
protected int charge = 0;
|
||||
//the build towards next charge, usually rolls over at 1.
|
||||
//better to keep charge as an int and use a separate float than casting.
|
||||
protected float partialCharge = 0;
|
||||
//the maximum charge, varies per artifact, not all artifacts use this.
|
||||
protected int chargeCap = 0;
|
||||
|
||||
//used by some artifacts to keep track of duration of effects or cooldowns to use.
|
||||
protected int cooldown = 0;
|
||||
//used by some artifacts to keep track of duration of effects or cooldowns to use.
|
||||
protected int cooldown = 0;
|
||||
|
||||
|
||||
public Artifact(){
|
||||
super();
|
||||
}
|
||||
public Artifact(){
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
actions.add( isEquipped( hero ) ? AC_UNEQUIP : AC_EQUIP );
|
||||
return actions;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
actions.add( isEquipped( hero ) ? AC_UNEQUIP : AC_EQUIP );
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doEquip( Hero hero ) {
|
||||
@Override
|
||||
public boolean doEquip( Hero hero ) {
|
||||
|
||||
if (hero.belongings.misc1 != null && hero.belongings.misc2 != null) {
|
||||
if (hero.belongings.misc1 != null && hero.belongings.misc2 != null) {
|
||||
|
||||
GLog.w("you can only wear 2 misc items at a time");
|
||||
return false;
|
||||
GLog.w("you can only wear 2 misc items at a time");
|
||||
return false;
|
||||
|
||||
} else if ((hero.belongings.misc1 != null && hero.belongings.misc1.getClass() == this.getClass())
|
||||
|| (hero.belongings.misc2 != null && hero.belongings.misc2.getClass() == this.getClass())){
|
||||
} else if ((hero.belongings.misc1 != null && hero.belongings.misc1.getClass() == this.getClass())
|
||||
|| (hero.belongings.misc2 != null && hero.belongings.misc2.getClass() == this.getClass())){
|
||||
|
||||
GLog.w("you cannot wear two of the same artifact");
|
||||
return false;
|
||||
GLog.w("you cannot wear two of the same artifact");
|
||||
return false;
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
if (hero.belongings.misc1 == null) {
|
||||
hero.belongings.misc1 = this;
|
||||
} else {
|
||||
hero.belongings.misc2 = this;
|
||||
}
|
||||
if (hero.belongings.misc1 == null) {
|
||||
hero.belongings.misc1 = this;
|
||||
} else {
|
||||
hero.belongings.misc2 = this;
|
||||
}
|
||||
|
||||
detach( hero.belongings.backpack );
|
||||
detach( hero.belongings.backpack );
|
||||
|
||||
activate( hero );
|
||||
activate( hero );
|
||||
|
||||
cursedKnown = true;
|
||||
identify();
|
||||
if (cursed) {
|
||||
equipCursed( hero );
|
||||
GLog.n( "the " + this.name + " painfully binds itself to you" );
|
||||
}
|
||||
cursedKnown = true;
|
||||
identify();
|
||||
if (cursed) {
|
||||
equipCursed( hero );
|
||||
GLog.n( "the " + this.name + " painfully binds itself to you" );
|
||||
}
|
||||
|
||||
hero.spendAndNext( TIME_TO_EQUIP );
|
||||
return true;
|
||||
hero.spendAndNext( TIME_TO_EQUIP );
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void activate( Char ch ) {
|
||||
passiveBuff = passiveBuff();
|
||||
passiveBuff.attachTo(ch);
|
||||
}
|
||||
public void activate( Char ch ) {
|
||||
passiveBuff = passiveBuff();
|
||||
passiveBuff.attachTo(ch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doUnequip( Hero hero, boolean collect, boolean single ) {
|
||||
if (super.doUnequip( hero, collect, single )) {
|
||||
@Override
|
||||
public boolean doUnequip( Hero hero, boolean collect, boolean single ) {
|
||||
if (super.doUnequip( hero, collect, single )) {
|
||||
|
||||
if (hero.belongings.misc1 == this) {
|
||||
hero.belongings.misc1 = null;
|
||||
} else {
|
||||
hero.belongings.misc2 = null;
|
||||
}
|
||||
if (hero.belongings.misc1 == this) {
|
||||
hero.belongings.misc1 = null;
|
||||
} else {
|
||||
hero.belongings.misc2 = null;
|
||||
}
|
||||
|
||||
passiveBuff.detach();
|
||||
passiveBuff = null;
|
||||
passiveBuff.detach();
|
||||
passiveBuff = null;
|
||||
|
||||
if (activeBuff != null){
|
||||
activeBuff.detach();
|
||||
activeBuff = null;
|
||||
}
|
||||
if (activeBuff != null){
|
||||
activeBuff.detach();
|
||||
activeBuff = null;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
return false;
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEquipped( Hero hero ) {
|
||||
return hero.belongings.misc1 == this || hero.belongings.misc2 == this;
|
||||
}
|
||||
@Override
|
||||
public boolean isEquipped( Hero hero ) {
|
||||
return hero.belongings.misc1 == this || hero.belongings.misc2 == this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUpgradable() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isUpgradable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visiblyUpgraded() {
|
||||
return ((level*10)/levelCap);
|
||||
}
|
||||
@Override
|
||||
public int visiblyUpgraded() {
|
||||
return ((level*10)/levelCap);
|
||||
}
|
||||
|
||||
//transfers upgrades from another artifact, transfer level will equal the displayed level
|
||||
public void transferUpgrade(int transferLvl) {
|
||||
upgrade(Math.round((float)(transferLvl*levelCap)/10));
|
||||
}
|
||||
//transfers upgrades from another artifact, transfer level will equal the displayed level
|
||||
public void transferUpgrade(int transferLvl) {
|
||||
upgrade(Math.round((float)(transferLvl*levelCap)/10));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String info() {
|
||||
if (cursed && cursedKnown && !isEquipped( Dungeon.hero )) {
|
||||
@Override
|
||||
public String info() {
|
||||
if (cursed && cursedKnown && !isEquipped( Dungeon.hero )) {
|
||||
|
||||
return desc() + "\n\nYou can feel a malevolent magic lurking within the " + name() + ".";
|
||||
return desc() + "\n\nYou can feel a malevolent magic lurking within the " + name() + ".";
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
return desc();
|
||||
return desc();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
if (levelKnown && level/levelCap != 0) {
|
||||
if (chargeCap > 0) {
|
||||
return Utils.format( TXT_TO_STRING_LVL_CHARGE, name(), visiblyUpgraded(), charge, chargeCap );
|
||||
} else {
|
||||
return Utils.format( TXT_TO_STRING_LVL, name(), visiblyUpgraded() );
|
||||
}
|
||||
} else {
|
||||
if (chargeCap > 0) {
|
||||
return Utils.format( TXT_TO_STRING_CHARGE, name(), charge, chargeCap );
|
||||
} else {
|
||||
return Utils.format( TXT_TO_STRING, name() );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (levelKnown && level/levelCap != 0) {
|
||||
if (chargeCap > 0) {
|
||||
return Utils.format( TXT_TO_STRING_LVL_CHARGE, name(), visiblyUpgraded(), charge, chargeCap );
|
||||
} else {
|
||||
return Utils.format( TXT_TO_STRING_LVL, name(), visiblyUpgraded() );
|
||||
}
|
||||
} else {
|
||||
if (chargeCap > 0) {
|
||||
return Utils.format( TXT_TO_STRING_CHARGE, name(), charge, chargeCap );
|
||||
} else {
|
||||
return Utils.format( TXT_TO_STRING, name() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String status() {
|
||||
@Override
|
||||
public String status() {
|
||||
|
||||
//display the current cooldown
|
||||
if (cooldown != 0)
|
||||
return Utils.format( "%d", cooldown );
|
||||
//display the current cooldown
|
||||
if (cooldown != 0)
|
||||
return Utils.format( "%d", cooldown );
|
||||
|
||||
//display as percent
|
||||
if (chargeCap == 100)
|
||||
return Utils.format( "%d%%", charge );
|
||||
//display as percent
|
||||
if (chargeCap == 100)
|
||||
return Utils.format( "%d%%", charge );
|
||||
|
||||
//display as #/#
|
||||
if (chargeCap > 0)
|
||||
return Utils.format( "%d/%d", charge, chargeCap );
|
||||
//display as #/#
|
||||
if (chargeCap > 0)
|
||||
return Utils.format( "%d/%d", charge, chargeCap );
|
||||
|
||||
//if there's no cap -
|
||||
//- but there is charge anyway, display that charge
|
||||
if (charge != 0)
|
||||
return Utils.format( "%d", charge );
|
||||
//if there's no cap -
|
||||
//- but there is charge anyway, display that charge
|
||||
if (charge != 0)
|
||||
return Utils.format( "%d", charge );
|
||||
|
||||
//otherwise, if there's no charge, return null.
|
||||
return null;
|
||||
}
|
||||
//otherwise, if there's no charge, return null.
|
||||
return null;
|
||||
}
|
||||
|
||||
//converts class names to be more concise and readable.
|
||||
protected String convertName(String className){
|
||||
//removes known redundant parts of names.
|
||||
className = className.replaceFirst("ScrollOf|PotionOf", "");
|
||||
//converts class names to be more concise and readable.
|
||||
protected String convertName(String className){
|
||||
//removes known redundant parts of names.
|
||||
className = className.replaceFirst("ScrollOf|PotionOf", "");
|
||||
|
||||
//inserts a space infront of every uppercase character
|
||||
className = className.replaceAll("(\\p{Ll})(\\p{Lu})", "$1 $2");
|
||||
//inserts a space infront of every uppercase character
|
||||
className = className.replaceAll("(\\p{Ll})(\\p{Lu})", "$1 $2");
|
||||
|
||||
return className;
|
||||
};
|
||||
return className;
|
||||
};
|
||||
|
||||
@Override
|
||||
public Item random() {
|
||||
if (Random.Float() < 0.3f) {
|
||||
cursed = true;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Item random() {
|
||||
if (Random.Float() < 0.3f) {
|
||||
cursed = true;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int price() {
|
||||
int price = 100;
|
||||
if (level > 0)
|
||||
price += 50*((level*10)/levelCap);
|
||||
if (cursed && cursedKnown) {
|
||||
price /= 2;
|
||||
}
|
||||
if (price < 1) {
|
||||
price = 1;
|
||||
}
|
||||
return price;
|
||||
}
|
||||
@Override
|
||||
public int price() {
|
||||
int price = 100;
|
||||
if (level > 0)
|
||||
price += 50*((level*10)/levelCap);
|
||||
if (cursed && cursedKnown) {
|
||||
price /= 2;
|
||||
}
|
||||
if (price < 1) {
|
||||
price = 1;
|
||||
}
|
||||
return price;
|
||||
}
|
||||
|
||||
|
||||
protected ArtifactBuff passiveBuff() {
|
||||
return null;
|
||||
}
|
||||
protected ArtifactBuff passiveBuff() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected ArtifactBuff activeBuff() {return null; }
|
||||
protected ArtifactBuff activeBuff() {return null; }
|
||||
|
||||
public class ArtifactBuff extends Buff {
|
||||
public class ArtifactBuff extends Buff {
|
||||
|
||||
public int level() {
|
||||
return level;
|
||||
}
|
||||
public int level() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public boolean isCursed() {
|
||||
return cursed;
|
||||
}
|
||||
public boolean isCursed() {
|
||||
return cursed;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static final String IMAGE = "image";
|
||||
private static final String EXP = "exp";
|
||||
private static final String CHARGE = "charge";
|
||||
private static final String PARTIALCHARGE = "partialcharge";
|
||||
private static final String IMAGE = "image";
|
||||
private static final String EXP = "exp";
|
||||
private static final String CHARGE = "charge";
|
||||
private static final String PARTIALCHARGE = "partialcharge";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle(bundle);
|
||||
bundle.put( IMAGE, image );
|
||||
bundle.put( EXP , exp );
|
||||
bundle.put( CHARGE , charge );
|
||||
bundle.put( PARTIALCHARGE , partialCharge );
|
||||
}
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle(bundle);
|
||||
bundle.put( IMAGE, image );
|
||||
bundle.put( EXP , exp );
|
||||
bundle.put( CHARGE , charge );
|
||||
bundle.put( PARTIALCHARGE , partialCharge );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle(bundle);
|
||||
if (bundle.contains( IMAGE )) image = bundle.getInt( IMAGE );
|
||||
exp = bundle.getInt( EXP );
|
||||
charge = bundle.getInt( CHARGE );
|
||||
partialCharge = bundle.getFloat( PARTIALCHARGE );
|
||||
}
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle(bundle);
|
||||
if (bundle.contains( IMAGE )) image = bundle.getInt( IMAGE );
|
||||
exp = bundle.getInt( EXP );
|
||||
charge = bundle.getInt( CHARGE );
|
||||
partialCharge = bundle.getFloat( PARTIALCHARGE );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,127 +8,124 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
/**
|
||||
* Created by debenhame on 03/09/2014.
|
||||
*/
|
||||
public class CapeOfThorns extends Artifact {
|
||||
|
||||
{
|
||||
name = "Cape of Thorns";
|
||||
image = ItemSpriteSheet.ARTIFACT_CAPE;
|
||||
{
|
||||
name = "Cape of Thorns";
|
||||
image = ItemSpriteSheet.ARTIFACT_CAPE;
|
||||
|
||||
level = 0;
|
||||
levelCap = 10;
|
||||
level = 0;
|
||||
levelCap = 10;
|
||||
|
||||
charge = 0;
|
||||
chargeCap = 100;
|
||||
cooldown = 0;
|
||||
charge = 0;
|
||||
chargeCap = 100;
|
||||
cooldown = 0;
|
||||
|
||||
defaultAction = "NONE";
|
||||
}
|
||||
defaultAction = "NONE";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ArtifactBuff passiveBuff() {
|
||||
return new Thorns();
|
||||
}
|
||||
@Override
|
||||
protected ArtifactBuff passiveBuff() {
|
||||
return new Thorns();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
String desc = "These collapsed sheets of metal from the DM-300 have formed together into a rigid wearable " +
|
||||
"cape. The metal is old and coated in thick flakes of rust. It seems to store a deep energy, " +
|
||||
"perhaps it has some of the DM-300's power?";
|
||||
if (isEquipped( Dungeon.hero )) {
|
||||
desc += "\n\n";
|
||||
if (cooldown == 0)
|
||||
desc += "The cape feels reassuringly heavy on your shoulders. You're not sure if it will directly " +
|
||||
"help you in a fight, but it seems to be gaining energy from the damage you take.";
|
||||
else
|
||||
desc += "The cape seems to be releasing some stored energy, " +
|
||||
"it is radiating a protective power at all angles. ";
|
||||
}
|
||||
@Override
|
||||
public String desc() {
|
||||
String desc = "These collapsed sheets of metal from the DM-300 have formed together into a rigid wearable " +
|
||||
"cape. The metal is old and coated in thick flakes of rust. It seems to store a deep energy, " +
|
||||
"perhaps it has some of the DM-300's power?";
|
||||
if (isEquipped( Dungeon.hero )) {
|
||||
desc += "\n\n";
|
||||
if (cooldown == 0)
|
||||
desc += "The cape feels reassuringly heavy on your shoulders. You're not sure if it will directly " +
|
||||
"help you in a fight, but it seems to be gaining energy from the damage you take.";
|
||||
else
|
||||
desc += "The cape seems to be releasing some stored energy, " +
|
||||
"it is radiating a protective power at all angles. ";
|
||||
}
|
||||
|
||||
return desc;
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
public class Thorns extends ArtifactBuff{
|
||||
public class Thorns extends ArtifactBuff{
|
||||
|
||||
@Override
|
||||
public boolean act(){
|
||||
if (cooldown > 0) {
|
||||
cooldown--;
|
||||
if (cooldown == 0) {
|
||||
BuffIndicator.refreshHero();
|
||||
GLog.w("Your Cape becomes inert again.");
|
||||
}
|
||||
updateQuickslot();
|
||||
}
|
||||
spend(TICK);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean act(){
|
||||
if (cooldown > 0) {
|
||||
cooldown--;
|
||||
if (cooldown == 0) {
|
||||
BuffIndicator.refreshHero();
|
||||
GLog.w("Your Cape becomes inert again.");
|
||||
}
|
||||
updateQuickslot();
|
||||
}
|
||||
spend(TICK);
|
||||
return true;
|
||||
}
|
||||
|
||||
public int proc(int damage, Char attacker, Char defender){
|
||||
if (cooldown == 0){
|
||||
charge += damage*(0.5+level*0.05);
|
||||
if (charge >= chargeCap){
|
||||
charge = 0;
|
||||
cooldown = 10+level;
|
||||
GLog.p("Your Cape begins radiating energy, you feel protected!");
|
||||
BuffIndicator.refreshHero();
|
||||
}
|
||||
}
|
||||
public int proc(int damage, Char attacker, Char defender){
|
||||
if (cooldown == 0){
|
||||
charge += damage*(0.5+level*0.05);
|
||||
if (charge >= chargeCap){
|
||||
charge = 0;
|
||||
cooldown = 10+level;
|
||||
GLog.p("Your Cape begins radiating energy, you feel protected!");
|
||||
BuffIndicator.refreshHero();
|
||||
}
|
||||
}
|
||||
|
||||
if (cooldown != 0){
|
||||
int deflected = Random.NormalIntRange(0, damage);
|
||||
damage -= deflected;
|
||||
if (cooldown != 0){
|
||||
int deflected = Random.NormalIntRange(0, damage);
|
||||
damage -= deflected;
|
||||
|
||||
if (attacker != null && Level.adjacent(attacker.pos, defender.pos)) {
|
||||
attacker.damage(deflected, this);
|
||||
}
|
||||
if (attacker != null && Level.adjacent(attacker.pos, defender.pos)) {
|
||||
attacker.damage(deflected, this);
|
||||
}
|
||||
|
||||
exp+= deflected;
|
||||
exp+= deflected;
|
||||
|
||||
if (exp >= (level+1)*5 && level < levelCap){
|
||||
exp -= (level+1)*5;
|
||||
upgrade();
|
||||
GLog.p("Your Cape grows stronger!");
|
||||
}
|
||||
if (exp >= (level+1)*5 && level < levelCap){
|
||||
exp -= (level+1)*5;
|
||||
upgrade();
|
||||
GLog.p("Your Cape grows stronger!");
|
||||
}
|
||||
|
||||
}
|
||||
updateQuickslot();
|
||||
return damage;
|
||||
}
|
||||
}
|
||||
updateQuickslot();
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Thorns";
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Thorns";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "Your cape is radiating energy, surrounding you in a field of deflective force!\n" +
|
||||
"\n" +
|
||||
"All damage you receive is reduced while the thorns effect is active. Additionally, " +
|
||||
"if the attacker is next to you, the reduced amount is deflected back at the attacker.\n" +
|
||||
"\n" +
|
||||
"Your cape will continue radiating energy for " + dispTurns(cooldown) + ".";
|
||||
}
|
||||
@Override
|
||||
public String desc() {
|
||||
return "Your cape is radiating energy, surrounding you in a field of deflective force!\n" +
|
||||
"\n" +
|
||||
"All damage you receive is reduced while the thorns effect is active. Additionally, " +
|
||||
"if the attacker is next to you, the reduced amount is deflected back at the attacker.\n" +
|
||||
"\n" +
|
||||
"Your cape will continue radiating energy for " + dispTurns(cooldown) + ".";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
if (cooldown == 0)
|
||||
return BuffIndicator.NONE;
|
||||
else
|
||||
return BuffIndicator.THORNS;
|
||||
}
|
||||
@Override
|
||||
public int icon() {
|
||||
if (cooldown == 0)
|
||||
return BuffIndicator.NONE;
|
||||
else
|
||||
return BuffIndicator.THORNS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach(){
|
||||
cooldown = 0;
|
||||
charge = 0;
|
||||
super.detach();
|
||||
}
|
||||
@Override
|
||||
public void detach(){
|
||||
cooldown = 0;
|
||||
charge = 0;
|
||||
super.detach();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -17,152 +17,149 @@ import com.watabou.utils.Random;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by debenhame on 27/08/2014.
|
||||
*/
|
||||
public class ChaliceOfBlood extends Artifact {
|
||||
|
||||
private static final String TXT_CHALICE = "Chalice of Blood";
|
||||
private static final String TXT_YES = "Yes, I know what I'm doing";
|
||||
private static final String TXT_NO = "No, I changed my mind";
|
||||
private static final String TXT_PRICK =
|
||||
"Each time you use the chalice it will drain more life energy, "+
|
||||
"if you are not careful this draining effect can easily kill you.\n\n"+
|
||||
"Are you sure you want to offer it more life energy?";
|
||||
private static final String TXT_CHALICE = "Chalice of Blood";
|
||||
private static final String TXT_YES = "Yes, I know what I'm doing";
|
||||
private static final String TXT_NO = "No, I changed my mind";
|
||||
private static final String TXT_PRICK =
|
||||
"Each time you use the chalice it will drain more life energy, "+
|
||||
"if you are not careful this draining effect can easily kill you.\n\n"+
|
||||
"Are you sure you want to offer it more life energy?";
|
||||
|
||||
|
||||
{
|
||||
name = "Chalice of Blood";
|
||||
image = ItemSpriteSheet.ARTIFACT_CHALICE1;
|
||||
{
|
||||
name = "Chalice of Blood";
|
||||
image = ItemSpriteSheet.ARTIFACT_CHALICE1;
|
||||
|
||||
level = 0;
|
||||
levelCap = 10;
|
||||
}
|
||||
level = 0;
|
||||
levelCap = 10;
|
||||
}
|
||||
|
||||
public static final String AC_PRICK = "PRICK";
|
||||
public static final String AC_PRICK = "PRICK";
|
||||
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
if (isEquipped( hero ) && level < levelCap && !cursed)
|
||||
actions.add(AC_PRICK);
|
||||
return actions;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
if (isEquipped( hero ) && level < levelCap && !cursed)
|
||||
actions.add(AC_PRICK);
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Hero hero, String action ) {
|
||||
super.execute(hero, action);
|
||||
if (action.equals(AC_PRICK)){
|
||||
@Override
|
||||
public void execute(Hero hero, String action ) {
|
||||
super.execute(hero, action);
|
||||
if (action.equals(AC_PRICK)){
|
||||
|
||||
int damage = 3*(level*level);
|
||||
int damage = 3*(level*level);
|
||||
|
||||
if (damage > hero.HP*0.75) {
|
||||
if (damage > hero.HP*0.75) {
|
||||
|
||||
GameScene.show(
|
||||
new WndOptions(TXT_CHALICE, TXT_PRICK, TXT_YES, TXT_NO) {
|
||||
@Override
|
||||
protected void onSelect(int index) {
|
||||
if (index == 0)
|
||||
prick(Dungeon.hero);
|
||||
};
|
||||
}
|
||||
);
|
||||
GameScene.show(
|
||||
new WndOptions(TXT_CHALICE, TXT_PRICK, TXT_YES, TXT_NO) {
|
||||
@Override
|
||||
protected void onSelect(int index) {
|
||||
if (index == 0)
|
||||
prick(Dungeon.hero);
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
} else {
|
||||
prick(hero);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
prick(hero);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void prick(Hero hero){
|
||||
int damage = 3*(level*level);
|
||||
private void prick(Hero hero){
|
||||
int damage = 3*(level*level);
|
||||
|
||||
Earthroot.Armor armor = hero.buff(Earthroot.Armor.class);
|
||||
if (armor != null) {
|
||||
damage = armor.absorb(damage);
|
||||
}
|
||||
Earthroot.Armor armor = hero.buff(Earthroot.Armor.class);
|
||||
if (armor != null) {
|
||||
damage = armor.absorb(damage);
|
||||
}
|
||||
|
||||
damage -= Random.IntRange(0, hero.dr());
|
||||
damage -= Random.IntRange(0, hero.dr());
|
||||
|
||||
hero.sprite.operate( hero.pos );
|
||||
hero.busy();
|
||||
hero.spend(3f);
|
||||
if (damage <= 0){
|
||||
GLog.i("You prick yourself, and your blood drips into the chalice.");
|
||||
} else if (damage < 25){
|
||||
GLog.w("You prick yourself and the chalice feeds on you.");
|
||||
Sample.INSTANCE.play(Assets.SND_CURSED);
|
||||
hero.sprite.emitter().burst( ShadowParticle.CURSE, 6 );
|
||||
} else if (damage < 100){
|
||||
GLog.w("Your life essence drains into the chalice.");
|
||||
Sample.INSTANCE.play(Assets.SND_CURSED);
|
||||
hero.sprite.emitter().burst( ShadowParticle.CURSE, 12 );
|
||||
} else {
|
||||
GLog.w("The chalice devours your life energy.");
|
||||
Sample.INSTANCE.play(Assets.SND_CURSED);
|
||||
hero.sprite.emitter().burst( ShadowParticle.CURSE, 18 );
|
||||
}
|
||||
hero.sprite.operate( hero.pos );
|
||||
hero.busy();
|
||||
hero.spend(3f);
|
||||
if (damage <= 0){
|
||||
GLog.i("You prick yourself, and your blood drips into the chalice.");
|
||||
} else if (damage < 25){
|
||||
GLog.w("You prick yourself and the chalice feeds on you.");
|
||||
Sample.INSTANCE.play(Assets.SND_CURSED);
|
||||
hero.sprite.emitter().burst( ShadowParticle.CURSE, 6 );
|
||||
} else if (damage < 100){
|
||||
GLog.w("Your life essence drains into the chalice.");
|
||||
Sample.INSTANCE.play(Assets.SND_CURSED);
|
||||
hero.sprite.emitter().burst( ShadowParticle.CURSE, 12 );
|
||||
} else {
|
||||
GLog.w("The chalice devours your life energy.");
|
||||
Sample.INSTANCE.play(Assets.SND_CURSED);
|
||||
hero.sprite.emitter().burst( ShadowParticle.CURSE, 18 );
|
||||
}
|
||||
|
||||
if (damage > 0)
|
||||
hero.damage(damage, this);
|
||||
if (damage > 0)
|
||||
hero.damage(damage, this);
|
||||
|
||||
if (!hero.isAlive()) {
|
||||
Dungeon.fail(Utils.format( ResultDescriptions.ITEM, name ));
|
||||
GLog.n("The Chalice sucks your life essence dry...");
|
||||
} else {
|
||||
upgrade();
|
||||
}
|
||||
}
|
||||
if (!hero.isAlive()) {
|
||||
Dungeon.fail(Utils.format( ResultDescriptions.ITEM, name ));
|
||||
GLog.n("The Chalice sucks your life essence dry...");
|
||||
} else {
|
||||
upgrade();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item upgrade() {
|
||||
if (level >= 6)
|
||||
image = ItemSpriteSheet.ARTIFACT_CHALICE3;
|
||||
else if (level >= 2)
|
||||
image = ItemSpriteSheet.ARTIFACT_CHALICE2;
|
||||
return super.upgrade();
|
||||
}
|
||||
@Override
|
||||
public Item upgrade() {
|
||||
if (level >= 6)
|
||||
image = ItemSpriteSheet.ARTIFACT_CHALICE3;
|
||||
else if (level >= 2)
|
||||
image = ItemSpriteSheet.ARTIFACT_CHALICE2;
|
||||
return super.upgrade();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ArtifactBuff passiveBuff() {
|
||||
return new chaliceRegen();
|
||||
}
|
||||
@Override
|
||||
protected ArtifactBuff passiveBuff() {
|
||||
return new chaliceRegen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
String desc = "This shining silver chalice is oddly adorned with sharp gems at the rim. ";
|
||||
if (level < levelCap)
|
||||
desc += "The chalice is pulling your attention strangely, you feel like it wants something from you.";
|
||||
else
|
||||
desc += "The chalice is full and radiating energy.";
|
||||
@Override
|
||||
public String desc() {
|
||||
String desc = "This shining silver chalice is oddly adorned with sharp gems at the rim. ";
|
||||
if (level < levelCap)
|
||||
desc += "The chalice is pulling your attention strangely, you feel like it wants something from you.";
|
||||
else
|
||||
desc += "The chalice is full and radiating energy.";
|
||||
|
||||
if (isEquipped (Dungeon.hero)){
|
||||
desc += "\n\n";
|
||||
if (cursed)
|
||||
desc += "The cursed chalice has bound itself to your hand, and is slowly tugging at your life energy.";
|
||||
else if (level == 0)
|
||||
desc += "As you hold the chalice, you feel oddly compelled to prick yourself on the sharp gems.";
|
||||
else if (level < 3)
|
||||
desc += "Some of your blood is pooled into the chalice, you can subtly feel the chalice feeding life " +
|
||||
"energy into you. You still want to cut yourself on the chalice, even though you know it will hurt.";
|
||||
else if (level < 7)
|
||||
desc += "The chalice is about half full of your blood and you can feel it feeding life energy " +
|
||||
"into you. you still want to hurt yourself, the chalice needs your energy, it's your friend.";
|
||||
else if (level < levelCap)
|
||||
desc += "The chalice is getting pretty full, and the life force it's feeding you is stronger than " +
|
||||
"ever. You should give it more energy, you need too, your friend needs your energy, it needs " +
|
||||
"your help. Your friend knows you have limits though, it doesn't want you to die, just bleed.";
|
||||
else
|
||||
desc += "The chalice is filled to the brim with your life essence. You can feel the chalice pouring " +
|
||||
"life energy back into you. It's your best friend. It's happy with you. So happy. " +
|
||||
"You've done well. So well. You're being rewarded. You don't need to touch the sharp gems anymore.";
|
||||
}
|
||||
if (isEquipped (Dungeon.hero)){
|
||||
desc += "\n\n";
|
||||
if (cursed)
|
||||
desc += "The cursed chalice has bound itself to your hand, and is slowly tugging at your life energy.";
|
||||
else if (level == 0)
|
||||
desc += "As you hold the chalice, you feel oddly compelled to prick yourself on the sharp gems.";
|
||||
else if (level < 3)
|
||||
desc += "Some of your blood is pooled into the chalice, you can subtly feel the chalice feeding life " +
|
||||
"energy into you. You still want to cut yourself on the chalice, even though you know it will hurt.";
|
||||
else if (level < 7)
|
||||
desc += "The chalice is about half full of your blood and you can feel it feeding life energy " +
|
||||
"into you. you still want to hurt yourself, the chalice needs your energy, it's your friend.";
|
||||
else if (level < levelCap)
|
||||
desc += "The chalice is getting pretty full, and the life force it's feeding you is stronger than " +
|
||||
"ever. You should give it more energy, you need too, your friend needs your energy, it needs " +
|
||||
"your help. Your friend knows you have limits though, it doesn't want you to die, just bleed.";
|
||||
else
|
||||
desc += "The chalice is filled to the brim with your life essence. You can feel the chalice pouring " +
|
||||
"life energy back into you. It's your best friend. It's happy with you. So happy. " +
|
||||
"You've done well. So well. You're being rewarded. You don't need to touch the sharp gems anymore.";
|
||||
}
|
||||
|
||||
return desc;
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
public class chaliceRegen extends ArtifactBuff {
|
||||
public class chaliceRegen extends ArtifactBuff {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,251 +16,248 @@ import com.watabou.utils.Bundle;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by debenhame on 25/08/2014.
|
||||
*/
|
||||
public class CloakOfShadows extends Artifact {
|
||||
|
||||
{
|
||||
name = "Cloak of Shadows";
|
||||
image = ItemSpriteSheet.ARTIFACT_CLOAK;
|
||||
{
|
||||
name = "Cloak of Shadows";
|
||||
image = ItemSpriteSheet.ARTIFACT_CLOAK;
|
||||
|
||||
level = 0;
|
||||
exp = 0;
|
||||
levelCap = 15;
|
||||
level = 0;
|
||||
exp = 0;
|
||||
levelCap = 15;
|
||||
|
||||
charge = level+5;
|
||||
partialCharge = 0;
|
||||
chargeCap = level+5;
|
||||
charge = level+5;
|
||||
partialCharge = 0;
|
||||
chargeCap = level+5;
|
||||
|
||||
cooldown = 0;
|
||||
cooldown = 0;
|
||||
|
||||
defaultAction = AC_STEALTH;
|
||||
defaultAction = AC_STEALTH;
|
||||
|
||||
unique = true;
|
||||
bones = false;
|
||||
}
|
||||
unique = true;
|
||||
bones = false;
|
||||
}
|
||||
|
||||
private boolean stealthed = false;
|
||||
private boolean stealthed = false;
|
||||
|
||||
public static final String AC_STEALTH = "STEALTH";
|
||||
public static final String AC_STEALTH = "STEALTH";
|
||||
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
if (isEquipped( hero ) && charge > 1)
|
||||
actions.add(AC_STEALTH);
|
||||
return actions;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
if (isEquipped( hero ) && charge > 1)
|
||||
actions.add(AC_STEALTH);
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute( Hero hero, String action ) {
|
||||
if (action.equals( AC_STEALTH )) {
|
||||
@Override
|
||||
public void execute( Hero hero, String action ) {
|
||||
if (action.equals( AC_STEALTH )) {
|
||||
|
||||
if (!stealthed){
|
||||
if (!isEquipped(hero)) GLog.i("You need to equip your cloak to do that.");
|
||||
else if (cooldown > 0) GLog.i("Your cloak needs " + cooldown + " more rounds to re-energize.");
|
||||
else if (charge <= 1) GLog.i("Your cloak hasn't recharged enough to be usable yet.");
|
||||
else {
|
||||
stealthed = true;
|
||||
hero.spend( 1f );
|
||||
hero.busy();
|
||||
Sample.INSTANCE.play(Assets.SND_MELD);
|
||||
activeBuff = activeBuff();
|
||||
activeBuff.attachTo(hero);
|
||||
if (hero.sprite.parent != null) {
|
||||
hero.sprite.parent.add(new AlphaTweener(hero.sprite, 0.4f, 0.4f));
|
||||
} else {
|
||||
hero.sprite.alpha(0.4f);
|
||||
}
|
||||
hero.sprite.operate(hero.pos);
|
||||
GLog.i("Your cloak blends you into the shadows.");
|
||||
}
|
||||
} else {
|
||||
stealthed = false;
|
||||
activeBuff.detach();
|
||||
activeBuff = null;
|
||||
hero.sprite.operate( hero.pos );
|
||||
GLog.i("You return from underneath your cloak.");
|
||||
}
|
||||
if (!stealthed){
|
||||
if (!isEquipped(hero)) GLog.i("You need to equip your cloak to do that.");
|
||||
else if (cooldown > 0) GLog.i("Your cloak needs " + cooldown + " more rounds to re-energize.");
|
||||
else if (charge <= 1) GLog.i("Your cloak hasn't recharged enough to be usable yet.");
|
||||
else {
|
||||
stealthed = true;
|
||||
hero.spend( 1f );
|
||||
hero.busy();
|
||||
Sample.INSTANCE.play(Assets.SND_MELD);
|
||||
activeBuff = activeBuff();
|
||||
activeBuff.attachTo(hero);
|
||||
if (hero.sprite.parent != null) {
|
||||
hero.sprite.parent.add(new AlphaTweener(hero.sprite, 0.4f, 0.4f));
|
||||
} else {
|
||||
hero.sprite.alpha(0.4f);
|
||||
}
|
||||
hero.sprite.operate(hero.pos);
|
||||
GLog.i("Your cloak blends you into the shadows.");
|
||||
}
|
||||
} else {
|
||||
stealthed = false;
|
||||
activeBuff.detach();
|
||||
activeBuff = null;
|
||||
hero.sprite.operate( hero.pos );
|
||||
GLog.i("You return from underneath your cloak.");
|
||||
}
|
||||
|
||||
} else
|
||||
super.execute(hero, action);
|
||||
}
|
||||
} else
|
||||
super.execute(hero, action);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(Char ch){
|
||||
super.activate(ch);
|
||||
if (stealthed){
|
||||
activeBuff = activeBuff();
|
||||
activeBuff.attachTo(ch);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void activate(Char ch){
|
||||
super.activate(ch);
|
||||
if (stealthed){
|
||||
activeBuff = activeBuff();
|
||||
activeBuff.attachTo(ch);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doUnequip(Hero hero, boolean collect, boolean single) {
|
||||
if (super.doUnequip(hero, collect, single)){
|
||||
stealthed = false;
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean doUnequip(Hero hero, boolean collect, boolean single) {
|
||||
if (super.doUnequip(hero, collect, single)){
|
||||
stealthed = false;
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ArtifactBuff passiveBuff() {
|
||||
return new cloakRecharge();
|
||||
}
|
||||
@Override
|
||||
protected ArtifactBuff passiveBuff() {
|
||||
return new cloakRecharge();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ArtifactBuff activeBuff( ) {
|
||||
return new cloakStealth();
|
||||
}
|
||||
@Override
|
||||
protected ArtifactBuff activeBuff( ) {
|
||||
return new cloakStealth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item upgrade() {
|
||||
chargeCap++;
|
||||
return super.upgrade();
|
||||
}
|
||||
@Override
|
||||
public Item upgrade() {
|
||||
chargeCap++;
|
||||
return super.upgrade();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
String desc = "This light silken cloak shimmers in and out of your vision as it sways in the air. When worn, " +
|
||||
"it can be used to hide your presence for a short time.\n\n";
|
||||
@Override
|
||||
public String desc() {
|
||||
String desc = "This light silken cloak shimmers in and out of your vision as it sways in the air. When worn, " +
|
||||
"it can be used to hide your presence for a short time.\n\n";
|
||||
|
||||
if (level < 5)
|
||||
desc += "The cloak's magic has faded and it is not very powerful, perhaps it will regain strength through use.";
|
||||
else if (level < 10)
|
||||
desc += "The cloak's power has begun to return.";
|
||||
else if (level < 15)
|
||||
desc += "The cloak has almost returned to full strength.";
|
||||
else
|
||||
desc += "The cloak is at full potential and will work for extended durations.";
|
||||
if (level < 5)
|
||||
desc += "The cloak's magic has faded and it is not very powerful, perhaps it will regain strength through use.";
|
||||
else if (level < 10)
|
||||
desc += "The cloak's power has begun to return.";
|
||||
else if (level < 15)
|
||||
desc += "The cloak has almost returned to full strength.";
|
||||
else
|
||||
desc += "The cloak is at full potential and will work for extended durations.";
|
||||
|
||||
|
||||
if ( isEquipped (Dungeon.hero) )
|
||||
desc += "\n\nThe cloak rests around your shoulders.";
|
||||
if ( isEquipped (Dungeon.hero) )
|
||||
desc += "\n\nThe cloak rests around your shoulders.";
|
||||
|
||||
|
||||
return desc;
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
private static final String STEALTHED = "stealthed";
|
||||
private static final String COOLDOWN = "cooldown";
|
||||
private static final String STEALTHED = "stealthed";
|
||||
private static final String COOLDOWN = "cooldown";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle(bundle);
|
||||
bundle.put( STEALTHED, stealthed );
|
||||
bundle.put( COOLDOWN, cooldown );
|
||||
}
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle(bundle);
|
||||
bundle.put( STEALTHED, stealthed );
|
||||
bundle.put( COOLDOWN, cooldown );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle(bundle);
|
||||
stealthed = bundle.getBoolean( STEALTHED );
|
||||
cooldown = bundle.getInt( COOLDOWN );
|
||||
}
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle(bundle);
|
||||
stealthed = bundle.getBoolean( STEALTHED );
|
||||
cooldown = bundle.getInt( COOLDOWN );
|
||||
}
|
||||
|
||||
public class cloakRecharge extends ArtifactBuff{
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (charge < chargeCap) {
|
||||
if (!stealthed)
|
||||
partialCharge += (1f / (60 - (chargeCap-charge)*2));
|
||||
public class cloakRecharge extends ArtifactBuff{
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (charge < chargeCap) {
|
||||
if (!stealthed)
|
||||
partialCharge += (1f / (60 - (chargeCap-charge)*2));
|
||||
|
||||
if (partialCharge >= 1) {
|
||||
charge++;
|
||||
partialCharge -= 1;
|
||||
if (charge == chargeCap){
|
||||
partialCharge = 0;
|
||||
}
|
||||
if (partialCharge >= 1) {
|
||||
charge++;
|
||||
partialCharge -= 1;
|
||||
if (charge == chargeCap){
|
||||
partialCharge = 0;
|
||||
}
|
||||
|
||||
}
|
||||
} else
|
||||
partialCharge = 0;
|
||||
}
|
||||
} else
|
||||
partialCharge = 0;
|
||||
|
||||
if (cooldown > 0)
|
||||
cooldown --;
|
||||
if (cooldown > 0)
|
||||
cooldown --;
|
||||
|
||||
updateQuickslot();
|
||||
updateQuickslot();
|
||||
|
||||
spend( TICK );
|
||||
spend( TICK );
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class cloakStealth extends ArtifactBuff{
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.INVISIBLE;
|
||||
}
|
||||
public class cloakStealth extends ArtifactBuff{
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.INVISIBLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
if (super.attachTo( target )) {
|
||||
target.invisible++;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
if (super.attachTo( target )) {
|
||||
target.invisible++;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean act(){
|
||||
charge--;
|
||||
if (charge <= 0) {
|
||||
detach();
|
||||
GLog.w("Your cloak has run out of energy.");
|
||||
((Hero)target).interrupt();
|
||||
}
|
||||
@Override
|
||||
public boolean act(){
|
||||
charge--;
|
||||
if (charge <= 0) {
|
||||
detach();
|
||||
GLog.w("Your cloak has run out of energy.");
|
||||
((Hero)target).interrupt();
|
||||
}
|
||||
|
||||
exp += 10 + ((Hero)target).lvl;
|
||||
exp += 10 + ((Hero)target).lvl;
|
||||
|
||||
if (exp >= (level+1)*50 && level < levelCap) {
|
||||
upgrade();
|
||||
exp -= level*50;
|
||||
GLog.p("Your cloak grows stronger!");
|
||||
}
|
||||
if (exp >= (level+1)*50 && level < levelCap) {
|
||||
upgrade();
|
||||
exp -= level*50;
|
||||
GLog.p("Your cloak grows stronger!");
|
||||
}
|
||||
|
||||
updateQuickslot();
|
||||
updateQuickslot();
|
||||
|
||||
spend( TICK );
|
||||
spend( TICK );
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fx(boolean on) {
|
||||
if (on) target.sprite.add( CharSprite.State.INVISIBLE );
|
||||
else if (target.invisible == 0) target.sprite.remove( CharSprite.State.INVISIBLE );
|
||||
}
|
||||
@Override
|
||||
public void fx(boolean on) {
|
||||
if (on) target.sprite.add( CharSprite.State.INVISIBLE );
|
||||
else if (target.invisible == 0) target.sprite.remove( CharSprite.State.INVISIBLE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Cloaked";
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Cloaked";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "Your cloak of shadows is granting you invisibility while you are shrouded by it.\n" +
|
||||
"\n" +
|
||||
"While you are invisible enemies are unable to attack or follow you. " +
|
||||
"Most physical attacks and magical effects (such as scrolls and wands) will immediately cancel invisibility.\n" +
|
||||
"\n" +
|
||||
"You will remain cloaked until it is cancelled or your cloak runs out of charge.";
|
||||
}
|
||||
@Override
|
||||
public String desc() {
|
||||
return "Your cloak of shadows is granting you invisibility while you are shrouded by it.\n" +
|
||||
"\n" +
|
||||
"While you are invisible enemies are unable to attack or follow you. " +
|
||||
"Most physical attacks and magical effects (such as scrolls and wands) will immediately cancel invisibility.\n" +
|
||||
"\n" +
|
||||
"You will remain cloaked until it is cancelled or your cloak runs out of charge.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach() {
|
||||
if (target.invisible > 0)
|
||||
target.invisible--;
|
||||
stealthed = false;
|
||||
cooldown = 10 - (level / 3);
|
||||
@Override
|
||||
public void detach() {
|
||||
if (target.invisible > 0)
|
||||
target.invisible--;
|
||||
stealthed = false;
|
||||
cooldown = 10 - (level / 3);
|
||||
|
||||
updateQuickslot();
|
||||
super.detach();
|
||||
}
|
||||
}
|
||||
updateQuickslot();
|
||||
super.detach();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -20,9 +20,6 @@ import com.watabou.utils.Random;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by Evan on 23/05/2015.
|
||||
*/
|
||||
public class EtherealChains extends Artifact {
|
||||
|
||||
public static final String AC_CAST = "CAST";
|
||||
|
|
|
@ -21,200 +21,197 @@ import com.watabou.noosa.audio.Sample;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by debenhame on 26/08/2014.
|
||||
*/
|
||||
public class HornOfPlenty extends Artifact {
|
||||
|
||||
|
||||
{
|
||||
name = "Horn of Plenty";
|
||||
image = ItemSpriteSheet.ARTIFACT_HORN1;
|
||||
{
|
||||
name = "Horn of Plenty";
|
||||
image = ItemSpriteSheet.ARTIFACT_HORN1;
|
||||
|
||||
level = 0;
|
||||
levelCap = 30;
|
||||
level = 0;
|
||||
levelCap = 30;
|
||||
|
||||
charge = 0;
|
||||
partialCharge = 0;
|
||||
chargeCap = 10;
|
||||
charge = 0;
|
||||
partialCharge = 0;
|
||||
chargeCap = 10;
|
||||
|
||||
defaultAction = AC_EAT;
|
||||
}
|
||||
defaultAction = AC_EAT;
|
||||
}
|
||||
|
||||
private static final float TIME_TO_EAT = 3f;
|
||||
private static final float TIME_TO_EAT = 3f;
|
||||
|
||||
private float energy = 36f;
|
||||
private float energy = 36f;
|
||||
|
||||
public static final String AC_EAT = "EAT";
|
||||
public static final String AC_STORE = "STORE";
|
||||
public static final String AC_EAT = "EAT";
|
||||
public static final String AC_STORE = "STORE";
|
||||
|
||||
protected String inventoryTitle = "Select a piece of food";
|
||||
protected WndBag.Mode mode = WndBag.Mode.FOOD;
|
||||
protected String inventoryTitle = "Select a piece of food";
|
||||
protected WndBag.Mode mode = WndBag.Mode.FOOD;
|
||||
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
if (isEquipped( hero ) && charge > 0)
|
||||
actions.add(AC_EAT);
|
||||
if (isEquipped( hero ) && level < 30 && !cursed)
|
||||
actions.add(AC_STORE);
|
||||
return actions;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
if (isEquipped( hero ) && charge > 0)
|
||||
actions.add(AC_EAT);
|
||||
if (isEquipped( hero ) && level < 30 && !cursed)
|
||||
actions.add(AC_STORE);
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute( Hero hero, String action ) {
|
||||
super.execute(hero, action);
|
||||
@Override
|
||||
public void execute( Hero hero, String action ) {
|
||||
super.execute(hero, action);
|
||||
|
||||
if (action.equals(AC_EAT)){
|
||||
if (action.equals(AC_EAT)){
|
||||
|
||||
if (!isEquipped(hero)) GLog.i("You need to equip your horn to do that.");
|
||||
else if (charge == 0) GLog.i("Your horn has no food in it to eat!");
|
||||
else {
|
||||
((Hunger) hero.buff(Hunger.class)).satisfy(energy * charge);
|
||||
if (!isEquipped(hero)) GLog.i("You need to equip your horn to do that.");
|
||||
else if (charge == 0) GLog.i("Your horn has no food in it to eat!");
|
||||
else {
|
||||
((Hunger) hero.buff(Hunger.class)).satisfy(energy * charge);
|
||||
|
||||
//if you get at least 100 food energy from the horn
|
||||
if (charge >= 3) {
|
||||
switch (hero.heroClass) {
|
||||
case WARRIOR:
|
||||
if (hero.HP < hero.HT) {
|
||||
hero.HP = Math.min(hero.HP + 5, hero.HT);
|
||||
hero.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1);
|
||||
}
|
||||
break;
|
||||
case MAGE:
|
||||
//1 charge
|
||||
Buff.affect( hero, ScrollOfRecharging.Recharging.class, 4f );
|
||||
ScrollOfRecharging.charge(hero);
|
||||
break;
|
||||
case ROGUE:
|
||||
case HUNTRESS:
|
||||
break;
|
||||
}
|
||||
//if you get at least 100 food energy from the horn
|
||||
if (charge >= 3) {
|
||||
switch (hero.heroClass) {
|
||||
case WARRIOR:
|
||||
if (hero.HP < hero.HT) {
|
||||
hero.HP = Math.min(hero.HP + 5, hero.HT);
|
||||
hero.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1);
|
||||
}
|
||||
break;
|
||||
case MAGE:
|
||||
//1 charge
|
||||
Buff.affect( hero, ScrollOfRecharging.Recharging.class, 4f );
|
||||
ScrollOfRecharging.charge(hero);
|
||||
break;
|
||||
case ROGUE:
|
||||
case HUNTRESS:
|
||||
break;
|
||||
}
|
||||
|
||||
Statistics.foodEaten++;
|
||||
}
|
||||
charge = 0;
|
||||
Statistics.foodEaten++;
|
||||
}
|
||||
charge = 0;
|
||||
|
||||
hero.sprite.operate(hero.pos);
|
||||
hero.busy();
|
||||
SpellSprite.show(hero, SpellSprite.FOOD);
|
||||
Sample.INSTANCE.play(Assets.SND_EAT);
|
||||
GLog.i("You eat from the horn.");
|
||||
hero.sprite.operate(hero.pos);
|
||||
hero.busy();
|
||||
SpellSprite.show(hero, SpellSprite.FOOD);
|
||||
Sample.INSTANCE.play(Assets.SND_EAT);
|
||||
GLog.i("You eat from the horn.");
|
||||
|
||||
hero.spend(TIME_TO_EAT);
|
||||
hero.spend(TIME_TO_EAT);
|
||||
|
||||
Badges.validateFoodEaten();
|
||||
Badges.validateFoodEaten();
|
||||
|
||||
image = ItemSpriteSheet.ARTIFACT_HORN1;
|
||||
image = ItemSpriteSheet.ARTIFACT_HORN1;
|
||||
|
||||
updateQuickslot();
|
||||
}
|
||||
updateQuickslot();
|
||||
}
|
||||
|
||||
} else if (action.equals(AC_STORE)){
|
||||
} else if (action.equals(AC_STORE)){
|
||||
|
||||
GameScene.selectItem(itemSelector, mode, inventoryTitle);
|
||||
}
|
||||
}
|
||||
GameScene.selectItem(itemSelector, mode, inventoryTitle);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ArtifactBuff passiveBuff() {
|
||||
return new hornRecharge();
|
||||
}
|
||||
@Override
|
||||
protected ArtifactBuff passiveBuff() {
|
||||
return new hornRecharge();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
String desc = "This horn can't be blown into, but instead seems to fill up with food over time.\n\n";
|
||||
@Override
|
||||
public String desc() {
|
||||
String desc = "This horn can't be blown into, but instead seems to fill up with food over time.\n\n";
|
||||
|
||||
if (charge == 0)
|
||||
desc += "The horn is completely empty.";
|
||||
else if (charge < 3)
|
||||
desc += "The horn is almost empty, a few small fruits and berries sit in the back.";
|
||||
else if (charge < 7)
|
||||
desc += "The horn is partially filled, you can see several fruits & vegetables inside.";
|
||||
else if (charge < 10)
|
||||
desc += "The horn is getting quite full, several pieces of fresh produce are poking up towards the front.";
|
||||
else
|
||||
desc += "The horn is overflowing! A delicious array of fruit and veg is filling the horn up to its brim.";
|
||||
if (charge == 0)
|
||||
desc += "The horn is completely empty.";
|
||||
else if (charge < 3)
|
||||
desc += "The horn is almost empty, a few small fruits and berries sit in the back.";
|
||||
else if (charge < 7)
|
||||
desc += "The horn is partially filled, you can see several fruits & vegetables inside.";
|
||||
else if (charge < 10)
|
||||
desc += "The horn is getting quite full, several pieces of fresh produce are poking up towards the front.";
|
||||
else
|
||||
desc += "The horn is overflowing! A delicious array of fruit and veg is filling the horn up to its brim.";
|
||||
|
||||
if ( isEquipped( Dungeon.hero ) ){
|
||||
if (!cursed) {
|
||||
desc += "\n\nThe horn rests at your side and is surprisingly lightweight, even with food in it.";
|
||||
if ( isEquipped( Dungeon.hero ) ){
|
||||
if (!cursed) {
|
||||
desc += "\n\nThe horn rests at your side and is surprisingly lightweight, even with food in it.";
|
||||
|
||||
if (level < 15)
|
||||
desc += " Perhaps there is a way to increase the horn's power by giving it food energy.";
|
||||
} else {
|
||||
desc += "\n\nThe cursed horn has bound itself to your side, " +
|
||||
"it seems to be eager to take food rather than produce it.";
|
||||
}
|
||||
}
|
||||
if (level < 15)
|
||||
desc += " Perhaps there is a way to increase the horn's power by giving it food energy.";
|
||||
} else {
|
||||
desc += "\n\nThe cursed horn has bound itself to your side, " +
|
||||
"it seems to be eager to take food rather than produce it.";
|
||||
}
|
||||
}
|
||||
|
||||
return desc;
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
public class hornRecharge extends ArtifactBuff{
|
||||
public class hornRecharge extends ArtifactBuff{
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (charge < chargeCap && !cursed) {
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (charge < chargeCap && !cursed) {
|
||||
|
||||
//generates 0.25 food value every round, +0.015 value per level
|
||||
//to a max of 0.70 food value per round (0.25+0.5, at level 30)
|
||||
partialCharge += 0.25f + (0.015f*level);
|
||||
//generates 0.25 food value every round, +0.015 value per level
|
||||
//to a max of 0.70 food value per round (0.25+0.5, at level 30)
|
||||
partialCharge += 0.25f + (0.015f*level);
|
||||
|
||||
//charge is in increments of 36 food value.
|
||||
if (partialCharge >= 36) {
|
||||
charge++;
|
||||
partialCharge -= 36;
|
||||
//charge is in increments of 36 food value.
|
||||
if (partialCharge >= 36) {
|
||||
charge++;
|
||||
partialCharge -= 36;
|
||||
|
||||
if (charge == chargeCap)
|
||||
image = ItemSpriteSheet.ARTIFACT_HORN4;
|
||||
else if (charge >= 7)
|
||||
image = ItemSpriteSheet.ARTIFACT_HORN3;
|
||||
else if (charge >= 3)
|
||||
image = ItemSpriteSheet.ARTIFACT_HORN2;
|
||||
else
|
||||
image = ItemSpriteSheet.ARTIFACT_HORN1;
|
||||
if (charge == chargeCap)
|
||||
image = ItemSpriteSheet.ARTIFACT_HORN4;
|
||||
else if (charge >= 7)
|
||||
image = ItemSpriteSheet.ARTIFACT_HORN3;
|
||||
else if (charge >= 3)
|
||||
image = ItemSpriteSheet.ARTIFACT_HORN2;
|
||||
else
|
||||
image = ItemSpriteSheet.ARTIFACT_HORN1;
|
||||
|
||||
if (charge == chargeCap){
|
||||
GLog.p("Your horn is full of food!");
|
||||
partialCharge = 0;
|
||||
}
|
||||
if (charge == chargeCap){
|
||||
GLog.p("Your horn is full of food!");
|
||||
partialCharge = 0;
|
||||
}
|
||||
|
||||
updateQuickslot();
|
||||
}
|
||||
} else
|
||||
partialCharge = 0;
|
||||
updateQuickslot();
|
||||
}
|
||||
} else
|
||||
partialCharge = 0;
|
||||
|
||||
spend( TICK );
|
||||
spend( TICK );
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected static WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||
@Override
|
||||
public void onSelect( Item item ) {
|
||||
if (item != null && item instanceof Food) {
|
||||
if (item instanceof Blandfruit && ((Blandfruit) item).potionAttrib == null){
|
||||
GLog.w("your horn rejects the unprepared blandfruit.");
|
||||
} else {
|
||||
Hero hero = Dungeon.hero;
|
||||
hero.sprite.operate( hero.pos );
|
||||
hero.busy();
|
||||
hero.spend( TIME_TO_EAT );
|
||||
protected static WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||
@Override
|
||||
public void onSelect( Item item ) {
|
||||
if (item != null && item instanceof Food) {
|
||||
if (item instanceof Blandfruit && ((Blandfruit) item).potionAttrib == null){
|
||||
GLog.w("your horn rejects the unprepared blandfruit.");
|
||||
} else {
|
||||
Hero hero = Dungeon.hero;
|
||||
hero.sprite.operate( hero.pos );
|
||||
hero.busy();
|
||||
hero.spend( TIME_TO_EAT );
|
||||
|
||||
curItem.upgrade(((Food)item).hornValue);
|
||||
if (curItem.level >= 30){
|
||||
curItem.level = 30;
|
||||
GLog.p("your horn has consumed all the food it can!");
|
||||
} else
|
||||
GLog.p("the horn consumes your food offering and grows in strength!");
|
||||
item.detach(hero.belongings.backpack);
|
||||
}
|
||||
curItem.upgrade(((Food)item).hornValue);
|
||||
if (curItem.level >= 30){
|
||||
curItem.level = 30;
|
||||
GLog.p("your horn has consumed all the food it can!");
|
||||
} else
|
||||
GLog.p("the horn consumes your food offering and grows in strength!");
|
||||
item.detach(hero.belongings.backpack);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -171,8 +171,8 @@ public class LloydsBeacon extends Artifact {
|
|||
Buff buff = Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class);
|
||||
if (buff != null) buff.detach();
|
||||
|
||||
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] ))
|
||||
if (mob instanceof DriedRose.GhostHero) mob.destroy();
|
||||
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] ))
|
||||
if (mob instanceof DriedRose.GhostHero) mob.destroy();
|
||||
|
||||
InterlevelScene.mode = InterlevelScene.Mode.RETURN;
|
||||
InterlevelScene.returnDepth = returnDepth;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user