V0.1.0 Partial Commit

changed package and application names to differentiate from main PD
release
This commit is contained in:
Evan Debenham
2014-08-03 14:46:22 -04:00
parent 65dd9c2dc0
commit aed303672a
474 changed files with 3468 additions and 3458 deletions
@@ -0,0 +1,37 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class BattleAxe extends MeleeWeapon {
{
name = "battle axe";
image = ItemSpriteSheet.BATTLE_AXE;
}
public BattleAxe() {
super( 4, 1.2f, 1f );
}
@Override
public String desc() {
return "The enormous steel head of this battle axe puts considerable heft behind each stroke.";
}
}
@@ -0,0 +1,37 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Dagger extends MeleeWeapon {
{
name = "dagger";
image = ItemSpriteSheet.DAGGER;
}
public Dagger() {
super( 1, 1.2f, 1f );
}
@Override
public String desc() {
return "A simple iron dagger with a well worn wooden handle.";
}
}
@@ -0,0 +1,37 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Glaive extends MeleeWeapon {
{
name = "glaive";
image = ItemSpriteSheet.GLAIVE;
}
public Glaive() {
super( 5, 1f, 1f );
}
@Override
public String desc() {
return "A polearm consisting of a sword blade on the end of a pole.";
}
}
@@ -0,0 +1,37 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Knuckles extends MeleeWeapon {
{
name = "knuckleduster";
image = ItemSpriteSheet.KNUCKLEDUSTER;
}
public Knuckles() {
super( 1, 1f, 0.5f );
}
@Override
public String desc() {
return "A piece of iron shaped to fit around the knuckles.";
}
}
@@ -0,0 +1,37 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Longsword extends MeleeWeapon {
{
name = "longsword";
image = ItemSpriteSheet.LONG_SWORD;
}
public Longsword() {
super( 4, 1f, 1f );
}
@Override
public String desc() {
return "This towering blade inflicts heavy damage by investing its heft into every cut.";
}
}
@@ -0,0 +1,37 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Mace extends MeleeWeapon {
{
name = "mace";
image = ItemSpriteSheet.MACE;
}
public Mace() {
super( 3, 1f, 0.8f );
}
@Override
public String desc() {
return "The iron head of this weapon inflicts substantial damage.";
}
}
@@ -0,0 +1,184 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.utils.Random;
public class MeleeWeapon extends Weapon {
private int tier;
public MeleeWeapon( int tier, float acu, float dly ) {
super();
this.tier = tier;
ACU = acu;
DLY = dly;
STR = typicalSTR();
MIN = min();
MAX = max();
}
private int min() {
return tier;
}
private int max() {
return (int)((tier * tier - tier + 10) / ACU * DLY);
}
@Override
public Item upgrade() {
return upgrade( false );
}
public Item upgrade( boolean enchant ) {
STR--;
MIN++;
MAX += tier;
return super.upgrade( enchant );
}
public Item safeUpgrade() {
return upgrade( enchantment != null );
}
@Override
public Item degrade() {
STR++;
MIN--;
MAX -= tier;
return super.degrade();
}
public int typicalSTR() {
return 8 + tier * 2;
}
@Override
public String info() {
final String p = "\n\n";
StringBuilder info = new StringBuilder( desc() );
String quality = levelKnown && level != 0 ? (level > 0 ? "upgraded" : "degraded") : "";
info.append( p );
info.append( "This " + name + " is " + Utils.indefinite( quality ) );
info.append( " tier-" + tier + " melee weapon. " );
if (levelKnown) {
info.append( "Its average damage is " + (MIN + (MAX - MIN) / 2) + " points per hit. " );
} else {
info.append(
"Its typical average damage is " + (min() + (max() - min()) / 2) + " points per hit " +
"and usually it requires " + typicalSTR() + " points of strength. " );
if (typicalSTR() > Dungeon.hero.STR()) {
info.append( "Probably this weapon is too heavy for you. " );
}
}
if (DLY != 1f) {
info.append( "This is a rather " + (DLY < 1f ? "fast" : "slow") );
if (ACU != 1f) {
if ((ACU > 1f) == (DLY < 1f)) {
info.append( " and ");
} else {
info.append( " but ");
}
info.append( ACU > 1f ? "accurate" : "inaccurate" );
}
info.append( " weapon. ");
} else if (ACU != 1f) {
info.append( "This is a rather " + (ACU > 1f ? "accurate" : "inaccurate") + " weapon. " );
}
if (enchantment != null) {
info.append( "It is enchanted." );
}
if (levelKnown && Dungeon.hero.belongings.backpack.items.contains( this )) {
if (STR > Dungeon.hero.STR()) {
info.append( p );
info.append(
"Because of your inadequate strength the accuracy and speed " +
"of your attack with this " + name + " is decreased." );
}
if (STR < Dungeon.hero.STR()) {
info.append( p );
info.append(
"Because of your excess strength the damage " +
"of your attack with this " + name + " is increased." );
}
}
if (isEquipped( Dungeon.hero )) {
info.append( p );
info.append( "You hold the " + name + " at the ready" +
(cursed ? ", and because it is cursed, you are powerless to let go." : ".") );
} else {
if (cursedKnown && cursed) {
info.append( p );
info.append( "You can feel a malevolent magic lurking within " + name +"." );
}
}
return info.toString();
}
@Override
public int price() {
int price = 20 * (1 << (tier - 1));
if (enchantment != null) {
price *= 1.5;
}
if (cursed && cursedKnown) {
price /= 2;
}
if (levelKnown) {
if (level > 0) {
price *= (level + 1);
} else if (level < 0) {
price /= (1 - level);
}
}
if (price < 1) {
price = 1;
}
return price;
}
@Override
public Item random() {
super.random();
if (Random.Int( 10 + level ) == 0) {
enchant( Enchantment.random() );
}
return this;
}
}
@@ -0,0 +1,38 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Quarterstaff extends MeleeWeapon {
{
name = "quarterstaff";
image = ItemSpriteSheet.QUARTERSTAFF;
}
public Quarterstaff() {
super( 2, 1f, 1f );
}
@Override
public String desc() {
// TODO Auto-generated method stub
return "A staff of hardwood, its ends are shod with iron.";
}
}
@@ -0,0 +1,129 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import java.util.ArrayList;
import com.watabou.noosa.audio.Sample;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
public class ShortSword extends MeleeWeapon {
public static final String AC_REFORGE = "REFORGE";
private static final String TXT_SELECT_WEAPON = "Select a weapon to upgrade";
private static final String TXT_REFORGED =
"you reforged the short sword to upgrade your %s";
private static final String TXT_NOT_BOOMERANG =
"you can't upgrade a boomerang this way";
private static final float TIME_TO_REFORGE = 2f;
private boolean equipped;
{
name = "short sword";
image = ItemSpriteSheet.SHORT_SWORD;
}
public ShortSword() {
super( 1, 1f, 1f );
STR = 11;
MAX = 12;
}
@Override
public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero );
if (level > 0) {
actions.add( AC_REFORGE );
}
return actions;
}
@Override
public void execute( Hero hero, String action ) {
if (action == AC_REFORGE) {
if (hero.belongings.weapon == this) {
equipped = true;
hero.belongings.weapon = null;
} else {
equipped = false;
detach( hero.belongings.backpack );
}
curUser = hero;
GameScene.selectItem( itemSelector, WndBag.Mode.WEAPON, TXT_SELECT_WEAPON );
} else {
super.execute( hero, action );
}
}
@Override
public String desc() {
return
"It is indeed quite short, just a few inches longer, than a dagger.";
}
private final WndBag.Listener itemSelector = new WndBag.Listener() {
@Override
public void onSelect( Item item ) {
if (item != null && !(item instanceof Boomerang)) {
Sample.INSTANCE.play( Assets.SND_EVOKE );
ScrollOfUpgrade.upgrade( curUser );
evoke( curUser );
GLog.w( TXT_REFORGED, item.name() );
((MeleeWeapon)item).safeUpgrade();
curUser.spendAndNext( TIME_TO_REFORGE );
Badges.validateItemLevelAquired( item );
} else {
if (item instanceof Boomerang) {
GLog.w( TXT_NOT_BOOMERANG );
}
if (equipped) {
curUser.belongings.weapon = ShortSword.this;
} else {
collect( curUser.belongings.backpack );
}
}
}
};
}
@@ -0,0 +1,37 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Spear extends MeleeWeapon {
{
name = "spear";
image = ItemSpriteSheet.SPEAR;
}
public Spear() {
super( 2, 1f, 1.5f );
}
@Override
public String desc() {
return "A slender wooden rod tipped with sharpened iron.";
}
}
@@ -0,0 +1,37 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Sword extends MeleeWeapon {
{
name = "sword";
image = ItemSpriteSheet.SWORD;
}
public Sword() {
super( 3, 1f, 1f );
}
@Override
public String desc() {
return "The razor-sharp length of steel blade shines reassuringly.";
}
}
@@ -0,0 +1,39 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class WarHammer extends MeleeWeapon {
{
name = "war hammer";
image = ItemSpriteSheet.WAR_HAMMER;
}
public WarHammer() {
super( 5, 1.2f, 1f );
}
@Override
public String desc() {
return
"Few creatures can withstand the crushing blow of this towering mass of lead and steel, " +
"but only the strongest of adventurers can use it effectively.";
}
}