Skip to content

Commit

Permalink
v0.1.3: Final commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Tianscar committed Mar 13, 2023
1 parent b7e7884 commit a2b876e
Show file tree
Hide file tree
Showing 14 changed files with 136 additions and 55 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.tianscar.pixeldungeonclasses.utils;

@FunctionalInterface
public interface QuietCallable<V> {

V call();

}
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ allprojects {
ext {
appPackageName = 'com.tianscar.carbonizedpixeldungeon'

appVersionCode = 102
appVersionName = '0.1.2'
appVersionCode = 103
appVersionName = '0.1.3'

appJavaCompatibility = JavaVersion.VERSION_1_8

Expand Down
6 changes: 6 additions & 0 deletions core/src/main/assets/messages/actors/actors.properties
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ actors.buffs.chill.freezes=%s freezes!
actors.buffs.chill.desc=Not quite frozen, but still much too cold.\n\nChilled targets perform all actions more slowly, depending on how many turns are left in the effect. At its worst, this is equivalent to being slowed.\n\nTurns of chill remaining: %1$s.\nSpeed is reduced by: %2$s%%

actors.buffs.combo.name=Combo
actors.buffs.combo.action_name=combo attack
actors.buffs.combo.combo=%d hit combo!
actors.buffs.combo.bad_target=You must target an enemy in attack range.
actors.buffs.combo.prompt=Select a target to attack.
Expand Down Expand Up @@ -235,6 +236,7 @@ actors.buffs.mindvision.desc=Somehow you are able to see all creatures on this f
actors.buffs.momentum.momentum=Building Momentum
actors.buffs.momentum.running=Freerunning
actors.buffs.momentum.resting=Recovering
actors.buffs.momentum.action_name=freerun
actors.buffs.momentum.momentum_desc=As he moves, the Freerunner builds momentum, which he can spend to start freerunning.\n\nEach charge of momentum grants two turns of freerunning, and the Freerunner can build up to 10 charges. Momentum is rapidly lost when the Freerunner stops moving.\n\nCurrent momentum charge: %d.
actors.buffs.momentum.running_desc=As he moves, the Freerunner builds momentum, which he can spend to start freerunning.\n\nWhile freerunning, the Freerunner moves at double speed and gains bonus evasion based on his level.\n\nTurns remaining: %d.
actors.buffs.momentum.resting_desc=As he moves, the Freerunner builds momentum, which he can spend to start freerunning.\n\nThe Freerunner needs time to regain his stamina before building momentum again.\n\nTurns remaining: %d.
Expand All @@ -260,6 +262,7 @@ actors.buffs.poison.rankings_desc=Succumbed to Poison
actors.buffs.poison.desc=Poison works its way through the body, slowly impairing its internal functioning.\n\nPoison deals damage each turn proportional to how long until it expires.\n\nTurns of poison remaining: %s.

actors.buffs.preparation.name=Preparation
actors.buffs.preparation.action_name=prepared strike
actors.buffs.preparation.desc=The Assassin is waiting patiently, preparing to strike from the shadows.
actors.buffs.preparation.desc_dmg=His next attack will deal _%1$d%% bonus damage_, and will execute regular enemies below _%2$d%% health_, or bosses below _%3$d%% health_.
actors.buffs.preparation.desc_dmg_likely=The attack will also be more likely to deal a larger amount of damage.
Expand Down Expand Up @@ -297,6 +300,9 @@ actors.buffs.slow.name=Slowed
actors.buffs.slow.desc=Slowing magic affects the target's rate of time, to them everything is moving super-fast.\n\nA slowed character performs all actions in twice the amount of time they would normally take.\n\nTurns of slow remaining: %s.

actors.buffs.snipersmark.name=Sniper's mark
actors.buffs.snipersmark.action_name_snapshot=snapshot
actors.buffs.snipersmark.action_name_volley=volley
actors.buffs.snipersmark.action_name_sniper=sniper shot
actors.buffs.snipersmark.desc=The Sniper is honed in on the target she most recently attacked. She is able to perform a special attack with her bow which will vary based on how the bow is augmented.\n\nAn unaugmented bow will fire a _snapshot,_ which deals reduced damage but does not take any time to fire.\n\nA bow augmented for speed will fire a _volley_ of three arrows. Each arrow will deal reduced damage, but can still activate enchantment. This volley takes 1 turn to shoot.\n\nA bow augmented for damage will fire a _sniper shot._ This shot is guaranteed to hit, deals bonus damage based on distance from the target, and takes 2 turns to fire.

actors.buffs.soulmark.name=Soul Marked
Expand Down
6 changes: 6 additions & 0 deletions core/src/main/assets/messages/actors/actors_tc.properties
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ actors.buffs.chill.freezes=%s凍住了!
actors.buffs.chill.desc=還沒有完全凍住,不過已經非常冷了。\n\n凍傷的目標所有行動都會更加緩慢,減速程度取決於剩餘的凍傷效果時間。最嚴重的凍傷情況等同於遲緩效果。\n\n剩餘的凍傷效果時長:%1$s回合\n當前減少的速度:%2$s%%

actors.buffs.combo.name=連擊
actors.buffs.combo.action_name=連擊
actors.buffs.combo.combo=%d連擊!
actors.buffs.combo.bad_target=你的目標必須是攻擊距離以內的敵人。
actors.buffs.combo.prompt=選擇一個目標以攻擊
Expand Down Expand Up @@ -235,6 +236,7 @@ actors.buffs.mindvision.desc=你可以在腦海中以某種方式看到這一層
actors.buffs.momentum.momentum=動量積蓄
actors.buffs.momentum.running=逸動
actors.buffs.momentum.resting=恢復
actors.buffs.momentum.action_name=逸動
actors.buffs.momentum.momentum_desc=移動的時候,疾行者會逐漸積蓄動能。疾行者可以消耗動量以開啟逸動狀態。\n\n每一點動量可以支持兩個回合的逸動,最多可以儲存10點動量。當疾行者停止移動時動量會快速消散。\n\n現有的動量:%d。
actors.buffs.momentum.running_desc=移動的時候,疾行者會逐漸積蓄動能。疾行者可以消耗動能以開啟逸動狀態。\n\n處於逸動狀態時,疾行者能夠以兩倍速移動,並且基於自身等級獲得額外的閃避屬性。\n\n效果剩餘回合數:%d。
actors.buffs.momentum.resting_desc=移動的時候,疾行者會逐漸積蓄動量。疾行者可以消耗動量以開啟逸動狀態。\n\n疾行者現在需要休息一會恢復體力才能重新積蓄動量。\n\n還需要休息%d回合。
Expand All @@ -260,6 +262,7 @@ actors.buffs.poison.rankings_desc=中毒致死
actors.buffs.poison.desc=毒素傳遍全身,緩慢地損傷著各個臟器。 \n\n毒素每回合造成的傷害與其剩餘的回合數成正比。 \n\n剩餘的中毒效果時長:%s回合

actors.buffs.preparation.name=準備階段
actors.buffs.preparation.action_name=蓄意打擊
actors.buffs.preparation.desc=刺客正耐心地等待著,準備從暗影中給出致命一擊。
actors.buffs.preparation.desc_dmg=他的下一次攻擊會造成_%1$d%%的額外傷害_,並瞬間斬殺生命低於_%2$d%%_的普通敵人,或生命低於_%3$d%%_的Boss。
actors.buffs.preparation.desc_dmg_likely=這一擊也更有可能造成額外的傷害。
Expand Down Expand Up @@ -297,6 +300,9 @@ actors.buffs.slow.name=遲緩
actors.buffs.slow.desc=減速魔法影響了目標的時間流速,在目標眼中所有的事物都移動得飛快。 \n\n遲緩下的角色執行所有行動花費的時間是其執行相同行動的兩倍。\n\n剩餘的遲緩效果持續時長:%s回合

actors.buffs.snipersmark.name=狙擊標記
actors.buffs.snipersmark.action_name_snapshot=速射
actors.buffs.snipersmark.action_name_volley=齊射
actors.buffs.snipersmark.action_name_sniper=強射
actors.buffs.snipersmark.desc=狙擊手會專注於最近射擊的目標,能夠用靈能弓進行一次特殊攻擊,攻擊方式取決於弓的改造方式。\n\n若持有未改造的弓,狙擊手可發射_瞬時箭矢_,造成低於正常箭矢的傷害,但不消耗時間。\n\n若持有加強了速度的弓,狙擊手可進行_三箭連發_。每枝箭造成低於正常箭矢的傷害,但能觸發附魔。消耗一回合。\n\n若持有加強了傷害的弓,狙擊手可發射_狙擊箭矢_。狙擊箭矢必定命中,造成基於與目標距離的額外傷害,消耗兩回合。

actors.buffs.soulmark.name=靈魂標記
Expand Down
6 changes: 6 additions & 0 deletions core/src/main/assets/messages/actors/actors_zh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ actors.buffs.chill.freezes=%s冻住了!
actors.buffs.chill.desc=还没有完全冻住,不过已经非常冷了。\n\n冻伤的目标所有行动都会更加缓慢,减速程度取决于剩余的冻伤效果时间。最严重的冻伤情况等同于迟缓效果。\n\n剩余的冻伤效果时长:%1$s回合\n当前减少的速度:%2$s%%

actors.buffs.combo.name=连击
actors.buffs.combo.action_name=连击
actors.buffs.combo.combo=%d连击!
actors.buffs.combo.bad_target=你的目标必须是攻击距离以内的敌人。
actors.buffs.combo.prompt=选择一个目标以攻击
Expand Down Expand Up @@ -235,6 +236,7 @@ actors.buffs.mindvision.desc=你可以在脑海中以某种方式看到这一层
actors.buffs.momentum.momentum=动量积蓄
actors.buffs.momentum.running=逸动
actors.buffs.momentum.resting=恢复
actors.buffs.momentum.action_name=逸动
actors.buffs.momentum.momentum_desc=移动的时候,疾行者会逐渐积蓄动能。疾行者可以消耗动量以开启逸动状态。\n\n每一点动量可以支持两个回合的逸动,最多可以储存10点动量。当疾行者停止移动时动量会快速消散。\n\n现有的动量:%d。
actors.buffs.momentum.running_desc=移动的时候,疾行者会逐渐积蓄动能。疾行者可以消耗动能以开启逸动状态。\n\n处于逸动状态时,疾行者能够以两倍速移动,并且基于自身等级获得额外的闪避属性。\n\n效果剩余回合数:%d。
actors.buffs.momentum.resting_desc=移动的时候,疾行者会逐渐积蓄动量。疾行者可以消耗动量以开启逸动状态。\n\n疾行者现在需要休息一会恢复体力才能重新积蓄动量。\n\n还需要休息%d回合。
Expand All @@ -260,6 +262,7 @@ actors.buffs.poison.rankings_desc=中毒致死
actors.buffs.poison.desc=毒素传遍全身,缓慢地损伤着各个脏器。 \n\n毒素每回合造成的伤害与其剩余的回合数成正比。 \n\n剩余的中毒效果时长:%s回合

actors.buffs.preparation.name=准备阶段
actors.buffs.preparation.action_name=蓄意打击
actors.buffs.preparation.desc=刺客正耐心地等待着,准备从暗影中给出致命一击。
actors.buffs.preparation.desc_dmg=他的下一次攻击会造成_%1$d%%的额外伤害_,并瞬间斩杀生命低于_%2$d%%_的普通敌人,或生命低于_%3$d%%_的Boss。
actors.buffs.preparation.desc_dmg_likely=这一击也更有可能造成额外的伤害。
Expand Down Expand Up @@ -297,6 +300,9 @@ actors.buffs.slow.name=迟缓
actors.buffs.slow.desc=减速魔法影响了目标的时间流速,在目标眼中所有的事物都移动得飞快。 \n\n迟缓下的角色执行所有行动花费的时间是其执行相同行动的两倍。\n\n剩余的迟缓效果持续时长:%s回合

actors.buffs.snipersmark.name=狙击标记
actors.buffs.snipersmark.action_name_snapshot=速射
actors.buffs.snipersmark.action_name_volley=齐射
actors.buffs.snipersmark.action_name_sniper=强射
actors.buffs.snipersmark.desc=狙击手会专注于最近射击的目标,能够用灵能弓进行一次特殊攻击,攻击方式取决于弓的改造方式。\n\n若持有未改造的弓,狙击手可发射_瞬时箭矢_,造成低于正常箭矢的伤害,但不消耗时间。\n\n若持有加强了速度的弓,狙击手可进行_三箭连发_。每支箭造成低于正常箭矢的伤害,但能触发附魔。消耗一回合。\n\n若持有加强了伤害的弓,狙击手可发射_狙击箭矢_。狙击箭矢必定命中,造成基于与目标距离的额外伤害,消耗两回合。

actors.buffs.soulmark.name=灵魂标记
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,30 @@
import com.tianscar.carbonizedpixeldungeon.items.weapon.SpiritBow;
import com.tianscar.carbonizedpixeldungeon.items.weapon.melee.MeleeWeapon;
import com.tianscar.carbonizedpixeldungeon.items.weapon.missiles.MissileWeapon;
import com.tianscar.pixeldungeonclasses.utils.QuietCallable;

// TODO Improve this
public class DualWielding {

private final QuietCallable<KindOfWeapon> weapon, extra;
public DualWielding( QuietCallable<KindOfWeapon> weapon, QuietCallable<KindOfWeapon> extra ) {
this.weapon = weapon;
this.extra = extra;
}

public DualWielding( Hero hero ) {
this(hero.belongings::weapon, hero.belongings::extra);
}

public boolean canWeaponAttack = false;
public boolean canExtraAttack = false;

public KindOfWeapon weapon() {
return Dungeon.hero.belongings.weapon();
return weapon.call();
}

public KindOfWeapon extra() {
return Dungeon.hero.belongings.extra();
return extra.call();
}

public void weaponHitSound(float pitch) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public Hero() {
STR = STARTING_STR;

belongings = new Belongings( this );
dualWielding = new DualWielding();
dualWielding = new DualWielding( this );

visibleEnemies = new ArrayList<>();
}
Expand Down Expand Up @@ -436,29 +436,33 @@ public boolean shoot( Char enemy, MissileWeapon wep ) {

return hit;
}

@Override
public int attackSkill( Char target ) {
KindOfWeapon wep = belongings.weapon();


public int attackSkill( DualWielding dualWielding, Char target ) {
KindOfWeapon wep = dualWielding.weapon();

float accuracy = 1;
accuracy *= RingOfAccuracy.accuracyMultiplier( this );

if (wep instanceof MissileWeapon){
if (Dungeon.level.adjacent( pos, target.pos )) {
accuracy *= (0.5f + 0.2f*pointsInTalent(Talent.POINT_BLANK));
} else {
accuracy *= 1.5f;
}
}

if (dualWielding.weaponNotNull()) {
return (int)(attackSkill * accuracy * dualWielding.weaponAccuracyFactor( this ));
} else {
return (int)(attackSkill * accuracy);
}
}

@Override
public int attackSkill( Char target ) {
return attackSkill(dualWielding, target);
}

@Override
public int defenseSkill( Char enemy ) {

Expand Down Expand Up @@ -538,10 +542,9 @@ else if (belongings.extra() != null) {

return dr;
}

@Override
public int damageRoll() {
KindOfWeapon wep = belongings.weapon();

public int damageRoll(DualWielding dualWielding) {
KindOfWeapon wep = dualWielding.weapon();
int dmg;

if (dualWielding.weaponNotNull()) {
Expand All @@ -551,10 +554,15 @@ public int damageRoll() {
dmg = RingOfForce.damageRoll(this);
}
if (dmg < 0) dmg = 0;

return dmg;
}

@Override
public int damageRoll() {
return damageRoll(dualWielding);
}

@Override
public float speed() {

Expand Down Expand Up @@ -598,8 +606,8 @@ public boolean canSurpriseAttack(){
public boolean canAttack(Char enemy){
return dualWielding.weaponCanAttack(this, enemy);
}
public float attackDelay() {

public float attackDelay(DualWielding dualWielding) {
if (buff(Talent.LethalMomentumTracker.class) != null){
buff(Talent.LethalMomentumTracker.class).detach();
return 0;
Expand All @@ -608,7 +616,7 @@ public float attackDelay() {
if (dualWielding.weaponNotNull()) {

return dualWielding.weaponDelayFactor( 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
Expand All @@ -617,6 +625,10 @@ public float attackDelay() {
}
}

public float attackDelay() {
return attackDelay(dualWielding);
}

@Override
public void spend( float time ) {
justMoved = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.tianscar.carbonizedpixeldungeon.actors.Char;
import com.tianscar.carbonizedpixeldungeon.actors.buffs.Corruption;
import com.tianscar.carbonizedpixeldungeon.actors.buffs.Invisibility;
import com.tianscar.carbonizedpixeldungeon.actors.hero.DualWielding;
import com.tianscar.carbonizedpixeldungeon.actors.hero.Hero;
import com.tianscar.carbonizedpixeldungeon.actors.hero.Talent;
import com.tianscar.carbonizedpixeldungeon.actors.hero.abilities.ArmorAbility;
Expand Down Expand Up @@ -148,11 +149,17 @@ public static class ShadowAlly extends DirectableAlly {
immunities.add(Corruption.class);
}

public ShadowAlly(){
private DualWielding dualWielding;
private DualWielding dualWielding() {
if (dualWielding == null) dualWielding = new DualWielding( Dungeon.hero );
return dualWielding;
}

public ShadowAlly() {
super();
}

public ShadowAlly( int heroLevel ){
public ShadowAlly( int heroLevel ) {
super();
int hpBonus = 15 + 5*heroLevel;
hpBonus = Math.round(0.1f * Dungeon.hero.pointsInTalent(Talent.PERFECT_COPY) * hpBonus);
Expand Down Expand Up @@ -194,8 +201,8 @@ public int attackSkill(Char target) {
@Override
public int damageRoll() {
int damage = Random.NormalIntRange(10, 20);
int heroDamage = Dungeon.hero.damageRoll();
heroDamage /= Dungeon.hero.attackDelay(); //normalize hero damage based on atk speed
int heroDamage = Dungeon.hero.damageRoll(dualWielding());
heroDamage /= Dungeon.hero.attackDelay(dualWielding()); //normalize hero damage based on atk speed
heroDamage = Math.round(0.075f * Dungeon.hero.pointsInTalent(Talent.SHADOW_BLADE) * heroDamage);
if (heroDamage > 0){
damage += heroDamage;
Expand All @@ -207,13 +214,18 @@ public int damageRoll() {
public int attackProc( Char enemy, int damage ) {
damage = super.attackProc( enemy, damage );
if (Random.Int(4) < Dungeon.hero.pointsInTalent(Talent.SHADOW_BLADE)
&& Dungeon.hero.dualWielding.weaponNotNull()){
return Dungeon.hero.dualWielding.weaponProc( this, enemy, damage );
&& dualWielding().weaponNotNull()){
return dualWielding().weaponProc( this, enemy, damage );
} else {
return damage;
}
}

@Override
protected boolean canAttack(Char enemy) {
return dualWielding().weaponCanAttack(this, enemy) || super.canAttack(enemy);
}

@Override
public int drRoll() {
int dr = super.drRoll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ public class MirrorImage extends NPC {
}

private Hero hero;
private DualWielding dualWielding;
private int heroID;
public int armTier;

public DualWielding dualWielding = new DualWielding();

@Override
protected boolean act() {

if ( hero == null ){
if ( hero == null ) {
hero = (Hero)Actor.findById(heroID);
dualWielding = new DualWielding( hero );
if ( hero == null ){
die(null);
sprite.killAndErase();
Expand Down Expand Up @@ -98,24 +98,20 @@ public void restoreFromBundle( Bundle bundle ) {

public void duplicate( Hero hero ) {
this.hero = hero;
dualWielding = new DualWielding( hero );
heroID = this.hero.id();
Buff.affect(this, MirrorInvis.class, Short.MAX_VALUE);
}

@Override
public int damageRoll() {
int damage;
if (dualWielding.weaponNotNull()){
damage = dualWielding.weaponDamageRoll(this);
} else {
damage = hero.damageRoll(); //handles ring of force
}
int damage = hero.damageRoll( dualWielding );
return (damage+1)/2; //half hero damage, rounded up
}

@Override
public int attackSkill( Char target ) {
return hero.attackSkill(target);
return hero.attackSkill( dualWielding, target );
}

@Override
Expand All @@ -133,17 +129,17 @@ public int defenseSkill(Char enemy) {

@Override
public float attackDelay() {
return hero.attackDelay(); //handles ring of furor
return hero.attackDelay( dualWielding ); //handles ring of furor
}

@Override
protected boolean canAttack(Char enemy) {
return super.canAttack(enemy) || (dualWielding.weaponCanAttack(this, enemy));
return dualWielding.weaponCanAttack(this, enemy) || super.canAttack(enemy);
}

@Override
public int drRoll() {
if (hero != null && dualWielding.weaponNotNull()){
if (hero != null && dualWielding.weaponNotNull()) {
return Random.NormalIntRange(0, dualWielding.weaponDefenseFactor(this)/2);
} else {
return 0;
Expand Down
Loading

0 comments on commit a2b876e

Please sign in to comment.