Skip to content

Commit

Permalink
Added 4 new weapons, and reworked the Katana. Also added the ability …
Browse files Browse the repository at this point in the history
…for weapons to require more than 1 equip slot.
  • Loading branch information
Smujb committed Jan 16, 2021
1 parent 5098335 commit d4804a5
Show file tree
Hide file tree
Showing 25 changed files with 172 additions and 114 deletions.
27 changes: 20 additions & 7 deletions core/src/main/assets/messages/items/items.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1813,7 +1813,7 @@ items.weapon.melee.butchersknife.name=butcher's knife
items.weapon.melee.butchersknife.desc=Normally this is used for cutting things that are already dead...

items.weapon.melee.rapier.name=rapier
items.weapon.melee.rapier.desc=A long, sharp sword that is good for head-to head fights. Enemies will stumble back when you attack, letting you advance.
items.weapon.melee.rapier.desc=A short thrusting sword that is great for keeping opponents at bay. It is hard not to retreat when facing the relentless thrusting of this weapon, and when there is nowhere left to run, this weapon can be a deadly force.
items.weapon.melee.rapier.advance_enemy=When attacking with this weapon, you will force the enemy back.
items.weapon.melee.rapier.damage_wall=This weapon does _%s%%_ extra damage when the enemy is against a wall.

Expand Down Expand Up @@ -1884,21 +1884,34 @@ items.weapon.melee.runicblade.name=runic blade
items.weapon.melee.runicblade.desc=A mysterious weapon from a distant land, with a bright blue blade.
items.weapon.melee.runicblade.enchant_boost=This weapon boosts the power of enchantments applied to it.

items.weapon.melee.plainsword.name=plain sword
items.weapon.melee.plainsword.desc=This sword has a dull, oddly-coloured blade that resists magic.
items.weapon.melee.plainsword.enchant_reduce=This weapon reduces the power of enchantments applied to it.
items.weapon.melee.mundanesword.name=mundane sword
items.weapon.melee.mundanesword.desc=This sword has a dull, oddly-coloured blade that resists magic.
items.weapon.melee.mundanesword.enchant_reduce=This weapon reduces the power of enchantments applied to it.

items.weapon.melee.magical.stats_desc=This weapon benefits more from upgrades.

items.weapon.melee.katana.name=katana
items.weapon.melee.katana.desc=A thin but sharp blade that cuts through the air at incredible speeds. Excellent for parrying and attacking alike.
items.weapon.melee.katana.desc=A thick, sharp sword created from a refined steel. It's blade is heavier than that of a straight sword, allowing more precise cuts but requiring two hands to be used effectively.

items.weapon.melee.tachi.name=tachi
items.weapon.melee.tachi.desc=This blade is longer and wider than that of most Katanas. It sacrifices the speed of it's predecessors in favor of the longer reach and higher impact of a straight sword.

items.weapon.melee.wakizashi.name=wakizashi
items.weapon.melee.wakizashi.desc=The Wakizashi differs from most Katanas in that, to compensate for the blade's weight, it is made shorter than most swords. This reduces the potential damage output but increases its versatility.

items.weapon.melee.scimitar.name=scimitar
items.weapon.melee.scimitar.desc=A thick curved blade. Its shape allows for deadlier, yet less directly powerful attacks.
items.weapon.melee.scimitar.desc=A curved sword capable of surprisingly fast cuts. It's low weight makes this an excellent choice for relentless assault, not giving your opponent a moment to breathe.

items.weapon.melee.falchion.name=falchion
items.weapon.melee.falchion.desc=Similar in design to a Scimitar, but with a much heavier and sharper blade designed to inflict wounds that will not quickly heal.

items.weapon.melee.sickle.name=sickle
items.weapon.melee.sickle.desc=A small, cumbersome blade not built for combat. When it lands a hit, it can cause deep gashes which won't heal fast.

items.weapon.melee.estoc.name=estoc
items.weapon.melee.estoc.desc=A longer form of rapier that additionally has a blade for slashing motions. The length of this weapon rivals some polearms, however it's weight causes it to require two hands to use to it's full potential



items.weapon.melee.sharp.stats_desc=This weapon can cause bleeding.

Expand Down Expand Up @@ -2255,7 +2268,7 @@ items.item.free_of_curse=This item is free of evil magic.

items.kindofmisc.unequip_title=Unequip one item
items.kindofmisc.unequip_message=You can only wear two misc items at a time.

items.kindofmisc.requires_slots=This item requires %s equip slots.
items.kindofweapon.equip_cursed=Your grip involuntarily tightens around the weapon.

items.merchantsbeacon.name=merchant's beacon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,8 @@ public int damageRoll() {
}

public int miscSlots() {
return Constants.MISC_SLOTS;
if (hasBelongings()) return belongings.miscSlots();
else return Constants.MISC_SLOTS;
}

//FIXME possibly migrate this to a seperate class and use static vars?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
package com.shatteredpixel.yasd.general.actors.hero;

import com.shatteredpixel.yasd.general.Badges;
import com.shatteredpixel.yasd.general.Constants;
import com.shatteredpixel.yasd.general.Dungeon;
import com.shatteredpixel.yasd.general.actors.Char;
import com.shatteredpixel.yasd.general.actors.buffs.Berserk;
Expand Down Expand Up @@ -97,17 +98,18 @@ public int capacity(){
//########################## Stuff for handling chars with belongings ##########################
//##############################################################################################

public boolean canEquip(int slot) {//Use for setting specific properties for each slot.
public boolean canEquipItem(int slot) {//Use for setting specific properties for each slot.
return miscs[slot] == null;
}

public boolean canEquip() {//Use for setting specific properties for each slot.
for (int i = 0; i < miscs.length; i++) {
if (canEquip(i)) {
return true;
public boolean canEquip(int slotsReq) {//Use for setting specific properties for each slot.
int slots = 0;
for (int i = 0; i < owner.miscSlots(); i++) {
if (canEquipItem(i)) {
slots++;
}
}
return false;
return slots >= slotsReq;
}

public ArrayList<KindofMisc> getMiscsOfType(Class type ) {//Find equipped items of a certain kind
Expand Down Expand Up @@ -239,6 +241,12 @@ public float affectPerception(float perception) {
return perception;
}

public int miscSlots() {
int slots = Constants.MISC_SLOTS;
if (miscs != null) for (KindofMisc misc : miscs) if (misc != null) slots -= (misc.slotsUsed-1);
return slots;
}

//##############################################################################################
//####################### End of stuff for handling chars with belongings ######################
//##############################################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import com.shatteredpixel.yasd.general.items.TomeOfMastery;
import com.shatteredpixel.yasd.general.items.allies.DragonPendant;
import com.shatteredpixel.yasd.general.items.allies.PoisonDragonPendant;
import com.shatteredpixel.yasd.general.items.relics.EtherealChains;
import com.shatteredpixel.yasd.general.items.bags.MagicalHolster;
import com.shatteredpixel.yasd.general.items.bags.PotionBandolier;
import com.shatteredpixel.yasd.general.items.bags.PowerHolder;
Expand All @@ -58,6 +57,7 @@
import com.shatteredpixel.yasd.general.items.potions.PotionOfOvergrowth;
import com.shatteredpixel.yasd.general.items.powers.Blink;
import com.shatteredpixel.yasd.general.items.powers.LuckyBadge;
import com.shatteredpixel.yasd.general.items.relics.EtherealChains;
import com.shatteredpixel.yasd.general.items.scrolls.ScrollOfIdentify;
import com.shatteredpixel.yasd.general.items.scrolls.ScrollOfLullaby;
import com.shatteredpixel.yasd.general.items.scrolls.ScrollOfMagicMapping;
Expand Down Expand Up @@ -195,7 +195,7 @@ public static void initTest(Hero hero) {
if (item != null) {
item.random();
item.uncurse();
item.identify().collect();
item.identify().level(59).collect();
while (item.statReq() < item.bestHeroStatValue(hero) && item.isUpgradable()) {
item.upgrade();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@
import com.shatteredpixel.yasd.general.items.weapon.melee.ButchersKnife;
import com.shatteredpixel.yasd.general.items.weapon.melee.ChainWhip;
import com.shatteredpixel.yasd.general.items.weapon.melee.Dagger;
import com.shatteredpixel.yasd.general.items.weapon.melee.Estoc;
import com.shatteredpixel.yasd.general.items.weapon.melee.Falchion;
import com.shatteredpixel.yasd.general.items.weapon.melee.Flail;
import com.shatteredpixel.yasd.general.items.weapon.melee.Glove;
import com.shatteredpixel.yasd.general.items.weapon.melee.Greataxe;
Expand All @@ -227,7 +229,7 @@
import com.shatteredpixel.yasd.general.items.weapon.melee.MagesStaff;
import com.shatteredpixel.yasd.general.items.weapon.melee.MeleeWeapon;
import com.shatteredpixel.yasd.general.items.weapon.melee.Pitchfork;
import com.shatteredpixel.yasd.general.items.weapon.melee.PlainSword;
import com.shatteredpixel.yasd.general.items.weapon.melee.MundaneSword;
import com.shatteredpixel.yasd.general.items.weapon.melee.Polearm;
import com.shatteredpixel.yasd.general.items.weapon.melee.Rapier;
import com.shatteredpixel.yasd.general.items.weapon.melee.RoyalHalberd;
Expand All @@ -236,6 +238,8 @@
import com.shatteredpixel.yasd.general.items.weapon.melee.Sickle;
import com.shatteredpixel.yasd.general.items.weapon.melee.Staff;
import com.shatteredpixel.yasd.general.items.weapon.melee.Sword;
import com.shatteredpixel.yasd.general.items.weapon.melee.Tachi;
import com.shatteredpixel.yasd.general.items.weapon.melee.Wakizashi;
import com.shatteredpixel.yasd.general.items.weapon.melee.Whip;
import com.shatteredpixel.yasd.general.items.weapon.ranged.Bow;
import com.shatteredpixel.yasd.general.items.weapon.ranged.Crossbow;
Expand Down Expand Up @@ -567,12 +571,16 @@ public static int order( Item item ) {
ButchersKnife.class,
Rapier.class,
RoyalHalberd.class,
PlainSword.class,
MundaneSword.class,
Pitchfork.class,
HeroSword.class
HeroSword.class,
Estoc.class,
Falchion.class,
Wakizashi.class,
Tachi.class

};
WEAPON.probs = new float[]{ 1, 1, 0, 4, 4, 4, 6, 5, 5, 4, 4, 6, 4, 3, 3, 2, 2, 3, 1, 1, 4, 2, 2 };
WEAPON.probs = new float[]{ 1, 1, 0, 4, 4, 4, 6, 5, 5, 4, 4, 6, 4, 3, 3, 2, 2, 3, 1, 1, 4, 2, 2, 2, 2, 3, 2 };

SHIELD.classes = new Class<?>[] {
RoundShield.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,19 @@ public abstract class KindofMisc extends EquipableItem {

private static final float TIME_TO_EQUIP = 1f;

public int slotsUsed = 1;

@Override
public boolean doEquip(final Hero hero) {
final KindofMisc[] miscs = hero.belongings.miscs;
if (!hero.belongings.canEquip()) {
if (!hero.belongings.canEquip(slotsUsed)) {
if (slotsUsed > 1) {
GLog.negative(Messages.get(this, "requires_slots", slotsUsed));
return false;
}

String[] miscNames = new String[miscs.length];
for (int i = 0; i < miscs.length; i++) {
String[] miscNames = new String[hero.miscSlots()];
for (int i = 0; i < hero.miscSlots(); i++) {
miscNames[i] = miscs[i].toString();
}

Expand Down Expand Up @@ -86,7 +92,7 @@ protected void onSelect(int index) {
} else {

for (int i = 0; i < miscs.length; i++) {
if (hero.belongings.canEquip(i)) {
if (hero.belongings.canEquipItem(i)) {
hero.belongings.miscs[i] = this;
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ public int proc(Char attacker, Char defender, int damage) {
return super.proc(attacker, defender, damage);
}

@Override
protected boolean hasProperties() {
return true;
}

@Override
protected String propsDesc() {
return super.propsDesc() + "\n" + Messages.get(this, "causes_bleed") + "\n" + Messages.get(this, "causes_cripple");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ public int proc(Char attacker, Char defender, int damage) {
return super.proc(attacker, defender, damage);
}

@Override
protected boolean hasProperties() {
return true;
}

@Override
protected String propsDesc() {
return super.propsDesc() + "\n" + Messages.get(this, "causes_paralysis");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.shatteredpixel.yasd.general.items.weapon.melee;

import com.shatteredpixel.yasd.general.sprites.ItemSpriteSheet;

public class Estoc extends Rapier {

{
image = ItemSpriteSheet.Weapons.ESTOC;

RCH = 2;
damageFactor = 0.9f;
slotsUsed = 2;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.shatteredpixel.yasd.general.items.weapon.melee;

import com.shatteredpixel.yasd.general.actors.Char;
import com.shatteredpixel.yasd.general.actors.buffs.Bleeding;
import com.shatteredpixel.yasd.general.actors.buffs.Buff;
import com.shatteredpixel.yasd.general.messages.Messages;
import com.shatteredpixel.yasd.general.sprites.ItemSpriteSheet;
import com.watabou.utils.Random;

public class Falchion extends Scimitar {

{
image = ItemSpriteSheet.Weapons.FALCHION;

DLY = 1f;
}

@Override
public int proc(Char attacker, Char defender, int damage) {
if (Random.Int(3) == 0) {
Buff.affect( defender, Bleeding.class ).set( damage/3f );
}
return super.proc(attacker, defender, damage);
}

@Override
protected String propsDesc() {
return super.propsDesc() + "\n" + Messages.get(this, "causes_bleed");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,7 @@ public int proc(Char attacker, Char defender, int damage) {
return super.proc(attacker, defender, damage);
}

@Override
protected boolean hasProperties() {
return true;
}

@Override
@Override
protected String propsDesc() {
return super.propsDesc() + "\n" + Messages.get(this, "causes_paralysis");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ public int proc(Char attacker, Char defender, int damage) {
return super.proc(attacker, defender, damage);
}

@Override
protected boolean hasProperties() {
return true;
}

@Override
protected String propsDesc() {
return super.propsDesc() + Messages.get(this, "bless_bonus");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ public int proc(Char attacker, Char defender, int damage) {
return super.proc(attacker, defender, damage);
}

@Override
protected boolean hasProperties() {
return true;
}

@Override
protected String propsDesc() {
return super.propsDesc() + "\n" + Messages.get(this, "grass");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,36 @@
package com.shatteredpixel.yasd.general.items.weapon.melee;

import com.shatteredpixel.yasd.general.Assets;
import com.shatteredpixel.yasd.general.actors.Char;
import com.shatteredpixel.yasd.general.actors.buffs.Bleeding;
import com.shatteredpixel.yasd.general.actors.buffs.Buff;
import com.shatteredpixel.yasd.general.messages.Messages;
import com.shatteredpixel.yasd.general.sprites.ItemSpriteSheet;
import com.watabou.utils.Random;

public class Katana extends MeleeWeapon {

{
image = ItemSpriteSheet.Weapons.KATANA;

hitSound = Assets.Sounds.HIT_STAB;
hitSoundPitch = 1.3f;

DLY = 0.6f; //fast
slotsUsed = 2;

ACC = 1.2f;
}

@Override
public int proc(Char attacker, Char defender, int damage) {
if (Random.Int(3) == 0) {
Buff.affect( defender, Bleeding.class ).set( damage/3f );
}
return super.proc(attacker, defender, damage);
}

damageFactor = 0.5f;
@Override
protected String propsDesc() {
return super.propsDesc() + "\n" + Messages.get(this, "causes_bleed");
}
}
Loading

0 comments on commit d4804a5

Please sign in to comment.