]> www.infradead.org Git - users/mchehab/andors-trail.git/commitdiff
Implemented 3 new high-level skills (Rejuvenation, Taunt, Concussion).
authoroskar.wiksten <oskar.wiksten@08aca716-68be-ccc6-4d58-36f5abd142ac>
Mon, 7 May 2012 20:31:12 +0000 (20:31 +0000)
committeroskar.wiksten <oskar.wiksten@08aca716-68be-ccc6-4d58-36f5abd142ac>
Mon, 7 May 2012 20:31:12 +0000 (20:31 +0000)
git-svn-id: https://andors-trail.googlecode.com/svn/trunk@241 08aca716-68be-ccc6-4d58-36f5abd142ac

AndorsTrail/res/values/content_actorconditions.xml
AndorsTrail/res/values/strings.xml
AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/SkillInfoActivity.java
AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/ActorStatsController.java
AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/CombatController.java
AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/SkillController.java
AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/ability/SkillCollection.java
AndorsTrail/src/com/gpl/rpg/AndorsTrail/view/SkillListAdapter.java

index 034431ca00f6dec9c70a0f7c64fa6cf16cfcab4e..de8cc14bffbeda54f9651b423c393a0a8fa8a768 100644 (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>
index 2cb9752f7b8c5cf86e62a1ace2b79146dfd71002..0bf9b2da91e241c0135b13f8cbf5c2a54ab6d42b 100644 (file)
     <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>
index fd737262b02d576bcf8b2b30683eac8c2de6c61a..de2c115cf31095651bc2aaa1b458df5a7c2db7d8 100644 (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 "";
                }
index 408ce768a2a8ed47896fb6ca10fead223cc86a17..a205164b196d9f14cf97c9cdfb80049ebeee2791 100644 (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);
index 864383eb09a16fb7d150a3e021a1f780e9c96752..508f510dbdc9bfea96d7ad79753c130149bce7e0 100644 (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;
        }
        
 
index 02aacf5e23a3c412497fe20fd30fc0c99183a3a3..d9eb9faf0c3b2bcfa742ed6fd9f6f69daa5a955b 100644 (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);
                        }
                }
        }
index 5a863f2555ebd39b5df4cc51371d256c6501264e..2506a841a97009cfb32310661249589d000b2cfc 100644 (file)
@@ -34,8 +34,11 @@ public final class SkillCollection {
        public static final int SKILL_SHADOW_BLESS = 20;\r
        public static final int SKILL_CRIT1 = 21;                       // lowers atk ability\r
        public static final int SKILL_CRIT2 = 22;                       // lowers def ability\r
+       public static final int SKILL_REJUVENATION = 23;        // Reduces magnitudes of conditions\r
+       public static final int SKILL_TAUNT = 24;                       // Causes AP loss of attackers that miss\r
+       public static final int SKILL_CONCUSSION = 25;          // AC loss for monsters with (AC-BC)>N\r
        \r
-       public static final int NUM_SKILLS = SKILL_CRIT2 + 1;\r
+       public static final int NUM_SKILLS = SKILL_CONCUSSION + 1;\r
        \r
        public static final int PER_SKILLPOINT_INCREASE_WEAPON_CHANCE = 12;\r
        public static final int PER_SKILLPOINT_INCREASE_WEAPON_DAMAGE_MAX = 1;\r
@@ -59,8 +62,13 @@ public final class SkillCollection {
        public static final int PER_SKILLPOINT_INCREASE_EXPLOSS_PERCENT = 20;\r
        public static final int PER_SKILLPOINT_INCREASE_RESISTANCE_CHANCE_PERCENT = 10;\r
        public static final int PER_SKILLPOINT_INCREASE_RESISTANCE_SHADOW_BLESS = 5;\r
-       public static final int PER_SKILLPOINT_INCREASE_CRIT1 = 50;\r
-       public static final int PER_SKILLPOINT_INCREASE_CRIT2 = 50; \r
+       public static final int PER_SKILLPOINT_INCREASE_CRIT1_CHANCE = 50;\r
+       public static final int PER_SKILLPOINT_INCREASE_CRIT2_CHANCE = 50;\r
+       public static final int PER_SKILLPOINT_INCREASE_REJUVENATION_CHANCE = 20;\r
+       public static final int PER_SKILLPOINT_INCREASE_TAUNT_CHANCE = 25;\r
+       public static final int TAUNT_AP_LOSS = 2;\r
+       public static final int CONCUSSION_THRESHOLD = 50;\r
+       public static final int PER_SKILLPOINT_INCREASE_CONCUSSION_CHANCE = 15;\r
 \r
        public static final int MAX_LEVEL_BARTER = (int) Math.floor((float) Constants.MARKET_PRICEFACTOR_PERCENT / PER_SKILLPOINT_INCREASE_BARTER_PRICEFACTOR_PERCENTAGE);\r
        public static final int MAX_LEVEL_BARKSKIN = 5;\r
@@ -124,6 +132,20 @@ public final class SkillCollection {
                        ,SkillLevelRequirement.requireOtherSkill(SKILL_BETTER_CRITICALS, 6)\r
                        ,SkillLevelRequirement.requireOtherSkill(SKILL_CRIT1, 1)\r
                }));\r
+               initializeSkill(new SkillInfo(SKILL_REJUVENATION, 1, false, new SkillLevelRequirement[] { \r
+                       SkillLevelRequirement.requireOtherSkill(SKILL_RESISTANCE_BLOOD_DISORDER, 3)\r
+                       ,SkillLevelRequirement.requireOtherSkill(SKILL_RESISTANCE_MENTAL, 3)\r
+                       ,SkillLevelRequirement.requireOtherSkill(SKILL_RESISTANCE_PHYSICAL_CAPACITY, 3)\r
+               }));\r
+               initializeSkill(new SkillInfo(SKILL_TAUNT, 1, false, new SkillLevelRequirement[] { \r
+                       SkillLevelRequirement.requireOtherSkill(SKILL_EVASION, 2)\r
+                       ,SkillLevelRequirement.requireOtherSkill(SKILL_DODGE, 4)\r
+               }));\r
+               initializeSkill(new SkillInfo(SKILL_CONCUSSION, 1, false, new SkillLevelRequirement[] { \r
+                       SkillLevelRequirement.requireOtherSkill(SKILL_SPEED, 2)\r
+                       ,SkillLevelRequirement.requireOtherSkill(SKILL_WEAPON_CHANCE, 3)\r
+                       ,SkillLevelRequirement.requireOtherSkill(SKILL_WEAPON_DMG, 5)\r
+               }));\r
        }\r
 \r
        public SkillInfo getSkill(int skillID) {\r
index fe592ffc42f53bb195622e25f01455bcffcc965e..93de3575b5b180ac5b9a6cde6c66048b12d2aa97 100644 (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;
                }