Implemented 3 new high-level skills (Rejuvenation, Taunt, Concussion).

git-svn-id: https://andors-trail.googlecode.com/svn/trunk@241 08aca716-68be-ccc6-4d58-36f5abd142ac
This commit is contained in:
oskar.wiksten
2012-05-07 20:31:12 +00:00
parent 328a2e66a6
commit 8ef8f59da2
8 changed files with 115 additions and 22 deletions

View File

@@ -46,6 +46,7 @@
{shadowbless_guard|Shadow guardian blessing|actorconditions_1:91|0||1|||||||||||||1|30||||||||||1|};
{crit1|Internal bleeding|actorconditions_1:89|2|1||||||||||||||1||||1|-50|||-3|-3|||};
{crit2|Fracture|actorconditions_1:89|2|1||||||||||||||1||||||||||-50|-2|};
{concussion|Concussion|actorconditions_1:80|2|1||||||||||||||1|||||-30|||||||};
</string>
</resources>

View File

@@ -494,6 +494,15 @@
<string name="skill_longdescription_crit1">For every critical hit made, there is a %1$d %% chance that the hit will cause internal bleeding on the target, effectively causing the \'Internal bleeding\' condition on the target. Internal bleeding severely lowers offensive combat abilities, making the target less able to land successful attacks.</string>
<string name="skill_title_crit2">Fracture</string>
<string name="skill_shortdescription_crit2">Chance of bone fracture</string>
<string name="skill_longdescription_crit2">For every critical hit made, there is a %1$d %% chance that the hit will fracture some of the target\'s bones, effectively causing the \'Fracture\' condition on the target. This will severely lower the target\'s defensive combat abilities, making the it less able to defend itself in subsequent attacks.</string>
<string name="skill_longdescription_crit2">For every critical hit made, there is a %1$d %% chance that the hit will fracture some of the target\'s bones, effectively causing the \'Fracture\' condition on the target. This will severely lower the target\'s defensive combat abilities, making it less able to defend itself in subsequent attacks.</string>
<string name="skill_title_rejuvenation">Rejuvenation</string>
<string name="skill_shortdescription_rejuvenation">Chance of effect removal</string>
<string name="skill_longdescription_rejuvenation">Every round (6 seconds), there is a %1$d %% chance that one of the active negative actor conditions will be lowered by one magnitude. This applies to all effect types that affect the body; mental conditions such as Dazed, physical capacity conditions such as Fatigue and also blood disorders such as poison.</string>
<string name="skill_title_taunt">Taunt</string>
<string name="skill_shortdescription_taunt">Attacker loses AP on miss</string>
<string name="skill_longdescription_taunt">When an attacker makes an attack that misses, there is a %1$d %% chance that the attacker loses %2$d action points (AP). This applies to all types of melee attacks against you.</string>
<string name="skill_title_concussion">Concussion</string>
<string name="skill_shortdescription_concussion">Chance of concussion</string>
<string name="skill_longdescription_concussion">When making an attack on a target whose block chance (BC) is at least %1$d lower than your attack chance (AC), there is a %2$d %% chance that the hit will cause a concussion on the target. A concussion will severely lower the target\'s offensive combat abilities, making the target less able to land successful attacks.</string>
</resources>

View File

@@ -134,6 +134,9 @@ public final class SkillInfoActivity extends Activity {
case SkillCollection.SKILL_SHADOW_BLESS: return R.string.skill_title_shadow_bless;
case SkillCollection.SKILL_CRIT1: return R.string.skill_title_crit1;
case SkillCollection.SKILL_CRIT2: return R.string.skill_title_crit2;
case SkillCollection.SKILL_REJUVENATION: return R.string.skill_title_rejuvenation;
case SkillCollection.SKILL_TAUNT: return R.string.skill_title_taunt;
case SkillCollection.SKILL_CONCUSSION: return R.string.skill_title_concussion;
default:
return -1;
}
@@ -162,8 +165,11 @@ public final class SkillInfoActivity extends Activity {
case SkillCollection.SKILL_RESISTANCE_PHYSICAL_CAPACITY: return res.getString(R.string.skill_longdescription_resistance_physical_capacity, SkillCollection.PER_SKILLPOINT_INCREASE_RESISTANCE_CHANCE_PERCENT, SkillCollection.PER_SKILLPOINT_INCREASE_RESISTANCE_CHANCE_PERCENT * SkillCollection.MAX_LEVEL_RESISTANCE);
case SkillCollection.SKILL_RESISTANCE_BLOOD_DISORDER: return res.getString(R.string.skill_longdescription_resistance_blood_disorder, SkillCollection.PER_SKILLPOINT_INCREASE_RESISTANCE_CHANCE_PERCENT, SkillCollection.PER_SKILLPOINT_INCREASE_RESISTANCE_CHANCE_PERCENT * SkillCollection.MAX_LEVEL_RESISTANCE);
case SkillCollection.SKILL_SHADOW_BLESS: return res.getString(R.string.skill_longdescription_shadow_bless, SkillCollection.PER_SKILLPOINT_INCREASE_RESISTANCE_SHADOW_BLESS);
case SkillCollection.SKILL_CRIT1: return res.getString(R.string.skill_longdescription_crit1, SkillCollection.PER_SKILLPOINT_INCREASE_CRIT1);
case SkillCollection.SKILL_CRIT2: return res.getString(R.string.skill_longdescription_crit2, SkillCollection.PER_SKILLPOINT_INCREASE_CRIT2);
case SkillCollection.SKILL_CRIT1: return res.getString(R.string.skill_longdescription_crit1, SkillCollection.PER_SKILLPOINT_INCREASE_CRIT1_CHANCE);
case SkillCollection.SKILL_CRIT2: return res.getString(R.string.skill_longdescription_crit2, SkillCollection.PER_SKILLPOINT_INCREASE_CRIT2_CHANCE);
case SkillCollection.SKILL_REJUVENATION: return res.getString(R.string.skill_longdescription_rejuvenation, SkillCollection.PER_SKILLPOINT_INCREASE_REJUVENATION_CHANCE);
case SkillCollection.SKILL_TAUNT: return res.getString(R.string.skill_longdescription_taunt, SkillCollection.PER_SKILLPOINT_INCREASE_TAUNT_CHANCE, SkillCollection.TAUNT_AP_LOSS);
case SkillCollection.SKILL_CONCUSSION: return res.getString(R.string.skill_longdescription_concussion, SkillCollection.CONCUSSION_THRESHOLD, SkillCollection.PER_SKILLPOINT_INCREASE_CONCUSSION_CHANCE);
default:
return "";
}

View File

@@ -1,11 +1,14 @@
package com.gpl.rpg.AndorsTrail.controller;
import java.util.ArrayList;
import com.gpl.rpg.AndorsTrail.VisualEffectCollection;
import com.gpl.rpg.AndorsTrail.context.ViewContext;
import com.gpl.rpg.AndorsTrail.model.CombatTraits;
import com.gpl.rpg.AndorsTrail.model.ability.ActorCondition;
import com.gpl.rpg.AndorsTrail.model.ability.ActorConditionEffect;
import com.gpl.rpg.AndorsTrail.model.ability.ActorConditionType;
import com.gpl.rpg.AndorsTrail.model.ability.SkillCollection;
import com.gpl.rpg.AndorsTrail.model.ability.traits.AbilityModifierTraits;
import com.gpl.rpg.AndorsTrail.model.ability.traits.StatsModifierTraits;
import com.gpl.rpg.AndorsTrail.model.actor.Actor;
@@ -189,6 +192,9 @@ public class ActorStatsController {
}
public void applyConditionsToPlayer(Player player, boolean isFullRound) {
if (player.conditions.isEmpty()) return;
removeConditionsFromSkillEffects(player);
applyStatsEffects(player, isFullRound);
if (player.isDead()) {
view.controller.handlePlayerDeath();
@@ -199,6 +205,27 @@ public class ActorStatsController {
decreaseDurationAndRemoveConditions(player);
}
private void removeConditionsFromSkillEffects(Player player) {
if (SkillController.rollForSkillChance(player, SkillCollection.SKILL_REJUVENATION, SkillCollection.PER_SKILLPOINT_INCREASE_REJUVENATION_CHANCE)) {
ArrayList<Integer> potentialConditionsToDecrease = new ArrayList<Integer>();
for(int i = 0; i < player.conditions.size(); ++i) {
ActorCondition c = player.conditions.get(i);
if (!c.isTemporaryEffect()) continue;
potentialConditionsToDecrease.add(i);
}
if (potentialConditionsToDecrease.isEmpty()) return;
int i = potentialConditionsToDecrease.get(Constants.rnd.nextInt(potentialConditionsToDecrease.size()));
ActorCondition c = player.conditions.remove(i);
if (c.magnitude > 1) {
int magnitude = c.magnitude - 1;
player.conditions.add(i, new ActorCondition(c.conditionType, magnitude, c.duration));
}
recalculateActorCombatTraits(player);
}
}
public void applyConditionsToMonsters(PredefinedMap map, boolean isFullRound) {
for (MonsterSpawnArea a : map.spawnAreas) {
for (Monster m : a.monsters) {
@@ -231,7 +258,7 @@ public class ActorStatsController {
boolean removedAnyConditions = false;
for(int i = actor.conditions.size() - 1; i >= 0; --i) {
ActorCondition c = actor.conditions.get(i);
if (c.duration == ActorCondition.DURATION_FOREVER) continue;
if (!c.isTemporaryEffect()) continue;
c.duration -= 1;
if (c.duration <= 0) {
actor.conditions.remove(i);

View File

@@ -456,12 +456,14 @@ public final class CombatController implements VisualEffectCompletedCallback {
private AttackResult playerAttacks(WorldContext world, Monster currentMonster) {
AttackResult result = attack(world.model.player, currentMonster);
if (result.isCriticalHit) SkillController.applyCriticalHitSkillEffectsToMonster(world, model.player, currentMonster);
SkillController.applySkillEffectsFromPlayerAttack(result, world, currentMonster);
return result;
}
private AttackResult monsterAttacks(ModelContainer model, Monster currentMonster) {
return attack(currentMonster, model.player);
AttackResult result = attack(currentMonster, model.player);
SkillController.applySkillEffectsFromMonsterAttack(result, world, currentMonster);
return result;
}

View File

@@ -1,11 +1,13 @@
package com.gpl.rpg.AndorsTrail.controller;
import com.gpl.rpg.AndorsTrail.context.WorldContext;
import com.gpl.rpg.AndorsTrail.model.AttackResult;
import com.gpl.rpg.AndorsTrail.model.CombatTraits;
import com.gpl.rpg.AndorsTrail.model.ability.ActorConditionEffect;
import com.gpl.rpg.AndorsTrail.model.ability.ActorConditionType;
import com.gpl.rpg.AndorsTrail.model.ability.SkillCollection;
import com.gpl.rpg.AndorsTrail.model.ability.SkillInfo;
import com.gpl.rpg.AndorsTrail.model.actor.Actor;
import com.gpl.rpg.AndorsTrail.model.actor.Monster;
import com.gpl.rpg.AndorsTrail.model.actor.Player;
import com.gpl.rpg.AndorsTrail.model.item.ItemTypeCollection;
@@ -110,22 +112,43 @@ public final class SkillController {
return getRollBias(effect.chance, player, skill, -chanceIncreasePerSkillLevel);
}
public static void applyCriticalHitSkillEffectsToMonster(WorldContext world, Player player, Monster monster) {
int skillLevel = player.getSkillLevel(SkillCollection.SKILL_CRIT2);
if (skillLevel > 0) {
if (Constants.roll100(SkillCollection.PER_SKILLPOINT_INCREASE_CRIT2 * skillLevel)) {
ActorConditionType conditionType = world.actorConditionsTypes.getActorConditionType("crit2");
ActorConditionEffect effect = new ActorConditionEffect(conditionType, 1, 5, null);
ActorStatsController.applyActorCondition(monster, effect);
public static boolean rollForSkillChance(Player player, int skill, int chancePerSkillLevel) {
int skillLevel = player.getSkillLevel(skill);
if (skillLevel <= 0) return false;
return Constants.roll100(chancePerSkillLevel * skillLevel);
}
private static void addConditionToActor(Actor target, WorldContext world, String conditionName, int magnitude, int duration) {
ActorConditionType conditionType = world.actorConditionsTypes.getActorConditionType(conditionName);
ActorConditionEffect effect = new ActorConditionEffect(conditionType, magnitude, duration, null);
ActorStatsController.applyActorCondition(target, effect);
}
public static void applySkillEffectsFromPlayerAttack(AttackResult result, WorldContext world, Monster monster) {
if (!result.isHit) return;
Player player = world.model.player;
if (player.combatTraits.attackChance - monster.combatTraits.blockChance > SkillCollection.CONCUSSION_THRESHOLD) {
if (rollForSkillChance(player, SkillCollection.SKILL_CONCUSSION, SkillCollection.PER_SKILLPOINT_INCREASE_CONCUSSION_CHANCE)) {
addConditionToActor(monster, world, "concussion", 1, 5);
}
}
skillLevel = player.getSkillLevel(SkillCollection.SKILL_CRIT1);
if (skillLevel > 0) {
if (Constants.roll100(SkillCollection.PER_SKILLPOINT_INCREASE_CRIT1 * skillLevel)) {
ActorConditionType conditionType = world.actorConditionsTypes.getActorConditionType("crit1");
ActorConditionEffect effect = new ActorConditionEffect(conditionType, 1, 5, null);
ActorStatsController.applyActorCondition(monster, effect);
if (result.isCriticalHit) {
if (rollForSkillChance(player, SkillCollection.SKILL_CRIT2, SkillCollection.PER_SKILLPOINT_INCREASE_CRIT2_CHANCE)) {
addConditionToActor(monster, world, "crit2", 1, 5);
}
if (rollForSkillChance(player, SkillCollection.SKILL_CRIT1, SkillCollection.PER_SKILLPOINT_INCREASE_CRIT1_CHANCE)) {
addConditionToActor(monster, world, "crit1", 1, 5);
}
}
}
public static void applySkillEffectsFromMonsterAttack(AttackResult result, WorldContext world, Monster monster) {
if (!result.isHit) {
if (rollForSkillChance(world.model.player, SkillCollection.SKILL_TAUNT, SkillCollection.PER_SKILLPOINT_INCREASE_TAUNT_CHANCE)) {
monster.ap.subtract(SkillCollection.TAUNT_AP_LOSS, false);
}
}
}

View File

@@ -34,8 +34,11 @@ public final class SkillCollection {
public static final int SKILL_SHADOW_BLESS = 20;
public static final int SKILL_CRIT1 = 21; // lowers atk ability
public static final int SKILL_CRIT2 = 22; // lowers def ability
public static final int SKILL_REJUVENATION = 23; // Reduces magnitudes of conditions
public static final int SKILL_TAUNT = 24; // Causes AP loss of attackers that miss
public static final int SKILL_CONCUSSION = 25; // AC loss for monsters with (AC-BC)>N
public static final int NUM_SKILLS = SKILL_CRIT2 + 1;
public static final int NUM_SKILLS = SKILL_CONCUSSION + 1;
public static final int PER_SKILLPOINT_INCREASE_WEAPON_CHANCE = 12;
public static final int PER_SKILLPOINT_INCREASE_WEAPON_DAMAGE_MAX = 1;
@@ -59,8 +62,13 @@ public final class SkillCollection {
public static final int PER_SKILLPOINT_INCREASE_EXPLOSS_PERCENT = 20;
public static final int PER_SKILLPOINT_INCREASE_RESISTANCE_CHANCE_PERCENT = 10;
public static final int PER_SKILLPOINT_INCREASE_RESISTANCE_SHADOW_BLESS = 5;
public static final int PER_SKILLPOINT_INCREASE_CRIT1 = 50;
public static final int PER_SKILLPOINT_INCREASE_CRIT2 = 50;
public static final int PER_SKILLPOINT_INCREASE_CRIT1_CHANCE = 50;
public static final int PER_SKILLPOINT_INCREASE_CRIT2_CHANCE = 50;
public static final int PER_SKILLPOINT_INCREASE_REJUVENATION_CHANCE = 20;
public static final int PER_SKILLPOINT_INCREASE_TAUNT_CHANCE = 25;
public static final int TAUNT_AP_LOSS = 2;
public static final int CONCUSSION_THRESHOLD = 50;
public static final int PER_SKILLPOINT_INCREASE_CONCUSSION_CHANCE = 15;
public static final int MAX_LEVEL_BARTER = (int) Math.floor((float) Constants.MARKET_PRICEFACTOR_PERCENT / PER_SKILLPOINT_INCREASE_BARTER_PRICEFACTOR_PERCENTAGE);
public static final int MAX_LEVEL_BARKSKIN = 5;
@@ -124,6 +132,20 @@ public final class SkillCollection {
,SkillLevelRequirement.requireOtherSkill(SKILL_BETTER_CRITICALS, 6)
,SkillLevelRequirement.requireOtherSkill(SKILL_CRIT1, 1)
}));
initializeSkill(new SkillInfo(SKILL_REJUVENATION, 1, false, new SkillLevelRequirement[] {
SkillLevelRequirement.requireOtherSkill(SKILL_RESISTANCE_BLOOD_DISORDER, 3)
,SkillLevelRequirement.requireOtherSkill(SKILL_RESISTANCE_MENTAL, 3)
,SkillLevelRequirement.requireOtherSkill(SKILL_RESISTANCE_PHYSICAL_CAPACITY, 3)
}));
initializeSkill(new SkillInfo(SKILL_TAUNT, 1, false, new SkillLevelRequirement[] {
SkillLevelRequirement.requireOtherSkill(SKILL_EVASION, 2)
,SkillLevelRequirement.requireOtherSkill(SKILL_DODGE, 4)
}));
initializeSkill(new SkillInfo(SKILL_CONCUSSION, 1, false, new SkillLevelRequirement[] {
SkillLevelRequirement.requireOtherSkill(SKILL_SPEED, 2)
,SkillLevelRequirement.requireOtherSkill(SKILL_WEAPON_CHANCE, 3)
,SkillLevelRequirement.requireOtherSkill(SKILL_WEAPON_DMG, 5)
}));
}
public SkillInfo getSkill(int skillID) {

View File

@@ -116,6 +116,9 @@ public final class SkillListAdapter extends ArrayAdapter<SkillInfo> {
case SkillCollection.SKILL_SHADOW_BLESS: return R.string.skill_shortdescription_shadow_bless;
case SkillCollection.SKILL_CRIT1: return R.string.skill_shortdescription_crit1;
case SkillCollection.SKILL_CRIT2: return R.string.skill_shortdescription_crit2;
case SkillCollection.SKILL_REJUVENATION: return R.string.skill_shortdescription_rejuvenation;
case SkillCollection.SKILL_TAUNT: return R.string.skill_shortdescription_taunt;
case SkillCollection.SKILL_CONCUSSION: return R.string.skill_shortdescription_concussion;
default:
return -1;
}