Skip to content

Commit

Permalink
Playtesting
Browse files Browse the repository at this point in the history
  • Loading branch information
tukkek committed Sep 26, 2017
1 parent d089b7f commit 8211fa5
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 32 deletions.
3 changes: 2 additions & 1 deletion javelin/controller/action/world/CastSpells.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ int selecttarget() {
for (Combatant m : Squad.active.members) {
targets.add(m.source.toString());
}
int targetindex = Javelin.choose("Cast on...", targets, false, false);
int targetindex = Javelin.choose("Cast on...", targets,
targets.size() > 4, false);
return targetindex;
}

Expand Down
4 changes: 4 additions & 0 deletions javelin/controller/action/world/Dismiss.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ public void perform(WorldScreen screen) {
if (choice == dismissmercenaries) {
dismissmercenaries(mercenaries);
} else if (choice >= 0) {
if (dismissmercenaries != Integer.MIN_VALUE
&& choice >= dismissmercenaries) {
choice -= 1;
}
dismiss(squad.get(choice));
}
}
Expand Down
3 changes: 2 additions & 1 deletion javelin/controller/fight/Fight.java
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,8 @@ public void meld(Combatant hero, Meld m) {
* @return Created meld.
*/
public Meld addmeld(int x, int y, Combatant dead, BattleState s) {
if (dead.summoned || dead.getnumericstatus() != Combatant.STATUSDEAD) {
if (dead.summoned || dead.getnumericstatus() != Combatant.STATUSDEAD
|| !dead.source.isalive()) {
return null;
}
Meld m = new Meld(x, y, s.next.ap + 1, dead);
Expand Down
3 changes: 3 additions & 0 deletions javelin/controller/upgrade/classes/ClassLevelUpgrade.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package javelin.controller.upgrade.classes;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import javelin.Javelin;
Expand Down Expand Up @@ -149,6 +150,8 @@ private void upgradeattack(List<AttackSequence> sequences,
* Prevents an upgrade to reach a level where the character will receive a
* new attack per turn, which would need to modify the {@link Monster} to
* the point of creating new attacks, calculating 2-handed weapon bonuses...
*
* TODO can be converted to a {@link HashMap}
*/
public int checkfornewattack(Monster m, int babdelta) {
switch (m.getbaseattackbonus() + babdelta) {
Expand Down
5 changes: 5 additions & 0 deletions javelin/model/unit/Monster.java
Original file line number Diff line number Diff line change
Expand Up @@ -822,4 +822,9 @@ public ArrayList<Attack> getattacks() {
public float eat() {
return size() / 2f;
}

public boolean isalive() {
String type = this.type.toLowerCase();
return !type.contains("undead") && !type.contains("construct");
}
}
20 changes: 7 additions & 13 deletions javelin/model/unit/attack/AttackSequence.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package javelin.model.unit.attack;

import java.util.ArrayList;

import javelin.model.unit.CloneableList;
import javelin.model.unit.feat.attack.PowerAttack;
import javelin.model.unit.feat.attack.shot.RapidShot;
import javelin.view.screen.StatisticsScreen;

Expand All @@ -11,26 +11,20 @@
*
* @author alex
*/
public class AttackSequence extends ArrayList<Attack> {
public class AttackSequence extends CloneableList<Attack> {
/** @see PowerAttack */
public boolean powerful = false;
/**
* See {@link RapidShot}
*/
/** @see RapidShot */
public boolean rapid = false;

@Override
public String toString() {
return toString(null);
};
}

@Override
public AttackSequence clone() {
final AttackSequence clone = (AttackSequence) super.clone();
final int size = size();
for (int i = 0; i < size; i++) {
clone.set(i, get(i).clone());
}
return clone;
return (AttackSequence) super.clone();
}

public String toString(Combatant target) {
Expand Down
19 changes: 13 additions & 6 deletions javelin/model/world/location/fortification/Trove.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@
* Since the actual fight gives no xp or gold these results are doubled as
* treasure.
*
* TODO experience was a nice reward but too explotiable. You could dismiss
* mercenaries and have a larger XP reward, or divide the squad and have only
* reiceve all XP, which is super explotaible. If could trigger
* {@link #reward(Reward)} just after the battle is over, this could be easily
* solved.
*
* @author alex
*/
public class Trove extends Fortification {
enum Reward {
GOLD, EXPERIENCE, KEY, WORKER, RUBY;
GOLD, /* EXPERIENCE, */ KEY, WORKER, RUBY;

static Reward getrandom() {
Reward[] all = values();
Expand All @@ -45,7 +51,7 @@ static Reward getrandom() {
public Trove() {
super(DESCRIPTION, DESCRIPTION, 1, 20);
if (World.scenario.simpletroves) {
rewards[0] = Reward.EXPERIENCE;
rewards[0] = Reward.GOLD;
rewards[1] = Reward.GOLD;
} else {
rewards[0] = Reward.getrandom();
Expand Down Expand Up @@ -107,10 +113,11 @@ public boolean interact() {
}

String reward(Reward reward) {
if (reward == Reward.EXPERIENCE) {
return RewardCalculator.rewardxp(Squad.active.members,
Squad.active.members, originalgarrison, 2);
}
/*
* if (reward == Reward.EXPERIENCE) { return
* RewardCalculator.rewardxp(Squad.active.members, Squad.active.members,
* originalgarrison, 2); }
*/
if (reward == Reward.GOLD) {
int gold = RewardCalculator.receivegold(originalgarrison) * 2;
Squad.active.gold += gold;
Expand Down
13 changes: 3 additions & 10 deletions javelin/view/screen/SquadScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import javelin.Javelin;
import javelin.controller.comparator.MonsterNameComparator;
import javelin.model.unit.Monster;
import javelin.model.unit.Squad;
import javelin.model.unit.attack.Combatant;
Expand All @@ -29,20 +29,13 @@ public class SquadScreen extends InfoScreen {
List<Monster> tier = Javelin.MONSTERSBYCR.get(cr);
if (tier != null) {
for (Monster candidate : tier) {
String type = candidate.type.toLowerCase();
if (!type.contains("undead")
&& !type.contains("construct")) {
if (candidate.isalive()) {
CANDIDATES.add(candidate);
}
}
}
}
Collections.sort(CANDIDATES, new Comparator<Monster>() {
@Override
public int compare(Monster o1, Monster o2) {
return o1.toString().compareTo(o2.toString());
}
});
Collections.sort(CANDIDATES, MonsterNameComparator.INSTANCE);
}

ArrayList<Combatant> squad = new ArrayList<Combatant>();
Expand Down
5 changes: 4 additions & 1 deletion javelin/view/screen/StatisticsScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import javelin.model.unit.Monster;
import javelin.model.unit.Skills;
import javelin.model.unit.Spawner;
import javelin.model.unit.Squad;
import javelin.model.unit.abilities.BreathWeapon;
import javelin.model.unit.abilities.spell.Spell;
import javelin.model.unit.attack.AttackSequence;
Expand Down Expand Up @@ -126,10 +127,12 @@ static public String gettext(Combatant c, boolean toggle) {
}

static String showhp(Combatant c, Monster m) {
boolean isally = Fight.state == null ? Squad.active.members.contains(c)
: Fight.state.blueTeam.contains(c);
final String hp;
if (Javelin.DEBUG) {
hp = Integer.toString(c.hp);
} else if (Fight.state.blueTeam.contains(c)) {
} else if (isally) {
hp = Integer.toString(c.maxhp);
} else {
hp = "~" + c.source.hd.average();
Expand Down
2 changes: 2 additions & 0 deletions javelin/view/screen/WorldScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ void perform(KeyEvent keyEvent) {
for (final WorldAction a : WorldAction.ACTIONS) {
for (final String s : a.morekeys) {
if (s.equals(Character.toString(keyEvent.getKeyChar()))) {
Game.messagepanel.clear();
a.perform(this);
return;
}
Expand All @@ -165,6 +166,7 @@ void perform(KeyEvent keyEvent) {
for (final WorldAction a : WorldAction.ACTIONS) {
for (final int s : a.keys) {
if (s == keyEvent.getKeyCode()) {
Game.messagepanel.clear();
a.perform(this);
return;
}
Expand Down

0 comments on commit 8211fa5

Please sign in to comment.