v0.8.1: improved a few more buff icons, mainly subclass abilities

This commit is contained in:
Evan Debenham 2020-05-12 20:14:19 -04:00
parent 2dfa01e1ad
commit e837d28cf2
10 changed files with 68 additions and 27 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -136,6 +136,7 @@ public class Berserk extends Buff {
public void damage(int damage){
if (state == State.RECOVERING) return;
power = Math.min(1.1f, power + (damage/(float)target.HT)/3f );
BuffIndicator.refreshHero(); //show new power immediately
}
public void recover(float percent){
@ -157,19 +158,30 @@ public class Berserk extends Buff {
public void tintIcon(Image icon) {
switch (state){
case NORMAL: default:
if (power < 0.5f) icon.hardlight(1f, 1f, 1f - 2*(power));
else if (power < 1f) icon.hardlight(1f, 1.5f - power, 0f);
else icon.hardlight(1f, 0f, 0f);
if (power < 1f) icon.hardlight(1f, 0.5f, 0f);
else icon.hardlight(1f, 0f, 0f);
break;
case BERSERK:
icon.hardlight(1f, 0f, 0f);
break;
case RECOVERING:
icon.hardlight(1f - (levelRecovery*0.5f), 1f - (levelRecovery*0.3f), 1f);
icon.hardlight(0, 0, 1f);
break;
}
}
@Override
public float iconFadePercent() {
switch (state){
case NORMAL: default:
return Math.max(0f, 1f - power);
case BERSERK:
return 0f;
case RECOVERING:
return 1f - levelRecovery/2f;
}
}
@Override
public String toString() {
switch (state){

View File

@ -60,11 +60,17 @@ public class Combo extends Buff implements ActionIndicator.Action {
@Override
public void tintIcon(Image icon) {
if (comboTime >= 3f){
icon.resetColor();
} else {
icon.tint(0xb3b3b3, 0.5f + 0.5f*(3f + 1 - comboTime)/3f);
}
if (count >= 10) icon.hardlight(1f, 0f, 0f);
else if (count >= 8)icon.hardlight(1f, 0.8f, 0f);
else if (count >= 6)icon.hardlight(1f, 1f, 0f);
else if (count >= 4)icon.hardlight(0.8f, 1f, 0f);
else if (count >= 2)icon.hardlight(0f, 1f, 0f);
else icon.resetColor();
}
@Override
public float iconFadePercent() {
return (4 - comboTime)/4f;
}
@Override
@ -87,6 +93,8 @@ public class Combo extends Buff implements ActionIndicator.Action {
}
BuffIndicator.refreshHero(); //refresh the buff visually on-hit
}
public void miss( Char enemy ){

View File

@ -32,14 +32,6 @@ public class FlavourBuff extends Buff {
return true;
}
public static void greyIcon(Image icon, float startGrey, float remaining){
if (remaining >= startGrey){
icon.resetColor();
} else {
icon.tint(0xb3b3b3, 0.6f + 0.3f*(startGrey - remaining)/startGrey);
}
}
//flavour buffs can all just rely on cooldown()
protected String dispTurns() {
return dispTurns(visualcooldown());

View File

@ -38,6 +38,11 @@ public class Haste extends FlavourBuff {
return BuffIndicator.MOMENTUM;
}
@Override
public void tintIcon(Image icon) {
icon.hardlight(1f, 0.8f, 0f);
}
@Override
public float iconFadePercent() {
return Math.max(0, (DURATION - visualcooldown()) / DURATION);

View File

@ -72,11 +72,12 @@ public class Momentum extends Buff {
@Override
public void tintIcon(Image icon) {
if (stacks <= 5) {
icon.hardlight(0.2f * (stacks - 1), 1f, 0f);
} else {
icon.hardlight(1f, 1f - 0.2f*(stacks - 6), 0f);
}
icon.invert();
}
@Override
public float iconFadePercent() {
return (10-stacks)/10f;
}
@Override

View File

@ -158,6 +158,19 @@ public class Preparation extends Buff implements ActionIndicator.Action {
}
}
@Override
public float iconFadePercent() {
if (AttackLevel.getLvl(turnsInvis) == AttackLevel.LVL_5){
return 0;
} else {
float turnsForCur = AttackLevel.getLvl(turnsInvis).turnsReq;
float turnsForNext = AttackLevel.values()[AttackLevel.getLvl(turnsInvis).ordinal()+1].turnsReq;
turnsForNext -= turnsForCur;
float turnsToNext = turnsInvis - turnsForCur;
return Math.min(1, (turnsForNext - turnsToNext)/(turnsForNext));
}
}
@Override
public String toString() {
return Messages.get(this, "name");

View File

@ -38,6 +38,11 @@ public class Stamina extends FlavourBuff {
return BuffIndicator.MOMENTUM;
}
@Override
public void tintIcon(Image icon) {
icon.hardlight(0.5f, 1f, 0.5f);
}
@Override
public float iconFadePercent() {
return Math.max(0, (DURATION - visualcooldown()) / DURATION);

View File

@ -215,9 +215,14 @@ public class BuffIndicator extends Component {
public void updateIcon(){
icon.frame( film.get( buff.icon() ) );
buff.tintIcon(icon);
//logic here rounds down to the nearest pixel
//round up to the nearest pixel if <50% faded, otherwise round down
float fadeHeight = buff.iconFadePercent() * icon.height();
float zoom = (camera() != null) ? camera().zoom : 1;
grey.scale.set( icon.width(), (float)Math.floor(zoom*icon.height()*buff.iconFadePercent())/zoom);
if (fadeHeight < icon.height()/2f){
grey.scale.set( icon.width(), (float)Math.ceil(zoom*fadeHeight)/zoom);
} else {
grey.scale.set( icon.width(), (float)Math.floor(zoom*fadeHeight)/zoom);
}
}
@Override