From 6a7a9a8750b9d72afa7b9d2c791ee1ce2e891cd4 Mon Sep 17 00:00:00 2001 From: Gonk Date: Sun, 7 Jul 2019 22:55:32 +0200 Subject: [PATCH 1/2] added pole weapons category and proficiency, removed scythe category --- AndorsTrail/res/raw/itemcategories_1.json | 7 +++++++ .../raw/itemcategories_stoutford_combined.json | 7 ------- .../res/raw/itemlist_stoutford_combined.json | 4 ++-- AndorsTrail/res/values/strings.xml | 15 +++++++++------ .../AndorsTrail/activity/SkillInfoActivity.java | 2 ++ .../AndorsTrail/controller/SkillController.java | 4 +++- .../model/ability/SkillCollection.java | 2 ++ .../rpg/AndorsTrail/view/SkillListAdapter.java | 1 + 8 files changed, 26 insertions(+), 16 deletions(-) diff --git a/AndorsTrail/res/raw/itemcategories_1.json b/AndorsTrail/res/raw/itemcategories_1.json index 69fa84f30..e83cd4f13 100644 --- a/AndorsTrail/res/raw/itemcategories_1.json +++ b/AndorsTrail/res/raw/itemcategories_1.json @@ -97,6 +97,13 @@ "size":"large", "inventorySlot":"weapon" }, + { + "id":"pole", + "name":"Pole weapon", + "actionType":"equip", + "size":"large", + "inventorySlot":"weapon" + }, { "id":"buckler", "name":"Buckler", diff --git a/AndorsTrail/res/raw/itemcategories_stoutford_combined.json b/AndorsTrail/res/raw/itemcategories_stoutford_combined.json index 9601373df..7dd56c376 100644 --- a/AndorsTrail/res/raw/itemcategories_stoutford_combined.json +++ b/AndorsTrail/res/raw/itemcategories_stoutford_combined.json @@ -5,12 +5,5 @@ "actionType":"equip", "size":"std", "inventorySlot":"weapon" - }, - { - "id":"scythe", - "name":"Scythe", - "actionType":"equip", - "size":"large", - "inventorySlot":"weapon" } ] \ No newline at end of file diff --git a/AndorsTrail/res/raw/itemlist_stoutford_combined.json b/AndorsTrail/res/raw/itemlist_stoutford_combined.json index 67775c76e..e88fa4e75 100644 --- a/AndorsTrail/res/raw/itemlist_stoutford_combined.json +++ b/AndorsTrail/res/raw/itemlist_stoutford_combined.json @@ -188,7 +188,7 @@ "iconID":"items_weapons_3:3", "name":"Scythe", "displaytype":"ordinary", - "category":"scythe", + "category":"pole", "description":"This looks more suited to farming than fighting", "equipEffect":{ "increaseAttackDamage":{ @@ -207,7 +207,7 @@ "displaytype":"ordinary", "hasManualPrice":1, "baseMarketCost":464, - "category":"scythe", + "category":"pole", "description":"This looks more suited to farming than fighting", "equipEffect":{ "increaseAttackDamage":{ diff --git a/AndorsTrail/res/values/strings.xml b/AndorsTrail/res/values/strings.xml index 31f55ce7e..3c9c630ee 100644 --- a/AndorsTrail/res/values/strings.xml +++ b/AndorsTrail/res/values/strings.xml @@ -448,10 +448,10 @@ To level up this skill, you need at least level %1$d of the %2$s skill. To level up this skill, you need at least experience level %1$d. To level up this skill, you need at least %1$d %2$s (base stats). - You may select one skill to improve. - You may select %1$d skills to improve. - This level also gives you a new skill point to spend! - + You may select one skill to improve. + You may select %1$d skills to improve. + This level also gives you a new skill point to spend! + Create new savegame slot Overwrite savegame? This savegame contains a different player name (%1$s) than your current player name (%2$s). Are you sure you want to overwrite this savegame? @@ -470,7 +470,7 @@ Max HP: Max AP: - Cannot save the game while in combat. + Cannot save the game while in combat. Optimized drawing Disable this if you see graphical artifacts. Enabling this option will make the game only redraw changed parts of the screen every frame. @@ -582,6 +582,7 @@ Specialization: Dual wield Specialization: Two-handed weapon Specialization: Weapon and shield + Pole weapon proficiency Better at fighting with daggers Better at fighting with one-handed swords @@ -599,12 +600,13 @@ Expert at dual wielding Expert at two-handed weapons Expert at fighting with weapon and shield + Better at fighting with pole weapons For each skill level, increases attack chance when using daggers and shortswords by %1$d %% of the item\'s base attack chance, increases block chance by %2$d %% of the item\'s base block chance, and increases critical skill by %3$d %% of the item\'s base critical skill. For each skill level, increases attack chance of rapiers, longswords and broadswords by %1$d %% of the item\'s base attack chance, increases block chance by %2$d %% of the item\'s base block chance, and increases critical skill by %3$d %% of the item\'s base critical skill. For each skill level, increases attack chance of two-handed swords by %1$d %% of the item\'s base attack chance, increases block chance by %2$d %% of the item\'s base block chance, and increases critical skill by %3$d %% of the item\'s base critical skill. For each skill level, increases attack chance of axes and greataxes by %1$d %% of the item\'s base attack chance, increases block chance by %2$d %% of the item\'s base block chance, and increases critical skill by %3$d %% of the item\'s base critical skill. - For each skill level, increases attack chance of bludgeoning weapons by %1$d %% of the item\'s base attack chance, increases block chance by %2$d %% of the item\'s base block chance, and increases critical skill by %3$d %% of the item\'s base critical skill. This includes clubs, quarterstaves, maces, scepters, war hammers and giant hammers. + For each skill level, increases attack chance of bludgeoning weapons by %1$d %% of the item\'s base attack chance, increases block chance by %2$d %% of the item\'s base block chance, and increases critical skill by %3$d %% of the item\'s base critical skill. This includes clubs, quarterstaves, maces, scepters, war hammers and giant hammers. When fighting without a weapon and shield, gain %1$d attack chance, %2$d damage potential and %3$d block chance per skill level. Increase damage resistance by %1$d per skill level while having a shield equipped. While fighting without having any piece of armor equipped, gain %1$d block chance per skill level. Items made of cloth are not considered as being armor. @@ -626,6 +628,7 @@ Every skill level increases the attack chance of weapons with %1$d %% of their o Increases the attack chance of both wielded weapons by an additional %1$d %% of their original attack chances, in addition to the benefits given by the weapon style skill. The block chances of both wielded weapons are also increased by %2$d %% of their original block chances. Increases damage potential of two-handed weapons by an additional %1$d %% of the original damage potential, in addition to the benefits given by the weapon style skill. The attack chances of two-handed weapons are also increased by %2$d %% of their original attack chances. Increases both attack chances and damage potential of weapons. The attack chance is increased by %1$d %% of the original attack chance, and the damage potential is increased by %2$d %% of the original damage potential. + For each skill level, increases attack chance when using pole weapons by %1$d %% of the item\'s base attack chance, increases block chance by %2$d %% of the item\'s base block chance, and increases critical skill by %3$d %% of the item\'s base critical skill. Quickslot position Where to place the quickslots diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/SkillInfoActivity.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/SkillInfoActivity.java index d24d681a3..421e0c435 100644 --- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/SkillInfoActivity.java +++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/SkillInfoActivity.java @@ -151,6 +151,7 @@ public final class SkillInfoActivity extends Activity { case specializationDualWield: return R.string.skill_title_specialization_dualwield; case specialization2hand: return R.string.skill_title_specialization_2hand; case specializationWeaponShield: return R.string.skill_title_specialization_weapon_shield; + case weaponProficiencyPole: return R.string.skill_title_weapon_prof_pole; default: return -1; } @@ -200,6 +201,7 @@ public final class SkillInfoActivity extends Activity { case specializationDualWield: return res.getString(R.string.skill_longdescription_specialization_dualwield, SkillCollection.PER_SKILLPOINT_INCREASE_SPECIALIZATION_DUALWIELD_AC_PERCENT, SkillCollection.PER_SKILLPOINT_INCREASE_SPECIALIZATION_DUALWIELD_BC_PERCENT); case specialization2hand: return res.getString(R.string.skill_longdescription_specialization_2hand, SkillCollection.PER_SKILLPOINT_INCREASE_SPECIALIZATION_2HAND_DMG_PERCENT, SkillCollection.PER_SKILLPOINT_INCREASE_SPECIALIZATION_2HAND_AC_PERCENT); case specializationWeaponShield: return res.getString(R.string.skill_longdescription_specialization_weapon_shield, SkillCollection.PER_SKILLPOINT_INCREASE_SPECIALIZATION_WEAPON_AC_PERCENT, SkillCollection.PER_SKILLPOINT_INCREASE_SPECIALIZATION_WEAPON_DMG_PERCENT); + case weaponProficiencyPole: return res.getString(R.string.skill_longdescription_weapon_prof_pole, SkillCollection.PER_SKILLPOINT_INCREASE_WEAPON_PROF_AC_PERCENT, SkillCollection.PER_SKILLPOINT_INCREASE_WEAPON_PROF_BC_PERCENT, SkillCollection.PER_SKILLPOINT_INCREASE_WEAPON_PROF_CS_PERCENT); default: return ""; } diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/SkillController.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/SkillController.java index 68667b556..cd749e999 100644 --- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/SkillController.java +++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/SkillController.java @@ -284,11 +284,13 @@ public final class SkillController { return SkillID.weaponProficiency1hsword; else if (itemCategoryID.equals("2hsword")) return SkillID.weaponProficiency2hsword; - else if (itemCategoryID.equals("axe") || itemCategoryID.equals("axe2h") || itemCategoryID.equals("scythe")) + else if (itemCategoryID.equals("axe") || itemCategoryID.equals("axe2h")) return SkillID.weaponProficiencyAxe; else if (itemCategoryID.equals("club") || itemCategoryID.equals("staff") || itemCategoryID.equals("mace") || itemCategoryID.equals("scepter") || itemCategoryID.equals("hammer") || itemCategoryID.equals("hammer2h") || itemCategoryID.equals("whip")) return SkillID.weaponProficiencyBlunt; + else if (itemCategoryID.equals("pole")) + return SkillID.weaponProficiencyPole; } else if (category.isShield()) { return SkillID.armorProficiencyShield; } else if (category.isArmor()) { diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/ability/SkillCollection.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/ability/SkillCollection.java index cf9b82069..7479aa029 100644 --- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/ability/SkillCollection.java +++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/ability/SkillCollection.java @@ -53,6 +53,7 @@ public final class SkillCollection { ,specializationDualWield ,specialization2hand ,specializationWeaponShield + ,weaponProficiencyPole } // should be in the same number &U order as in arrays.xml @@ -206,6 +207,7 @@ public final class SkillCollection { initializeSkill(new SkillInfo(SkillID.weaponProficiencyAxe, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null)); initializeSkill(new SkillInfo(SkillID.weaponProficiencyBlunt, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null)); initializeSkill(new SkillInfo(SkillID.weaponProficiencyUnarmed, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null)); + initializeSkill(new SkillInfo(SkillID.weaponProficiencyPole, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null)); initializeSkill(new SkillInfo(SkillID.armorProficiencyShield, 2, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null)); initializeSkill(new SkillInfo(SkillID.armorProficiencyUnarmored, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null)); initializeSkill(new SkillInfo(SkillID.armorProficiencyLight, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null)); diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/view/SkillListAdapter.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/view/SkillListAdapter.java index d9c628bd3..04a9cf728 100644 --- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/view/SkillListAdapter.java +++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/view/SkillListAdapter.java @@ -158,6 +158,7 @@ public final class SkillListAdapter extends ArrayAdapter { case specializationDualWield: return R.string.skill_shortdescription_specialization_dualwield; case specialization2hand: return R.string.skill_shortdescription_specialization_2hand; case specializationWeaponShield: return R.string.skill_shortdescription_specialization_weapon_shield; + case weaponProficiencyPole: return R.string.skill_shortdescription_weapon_prof_pole; default: return -1; } From d04176e0550159404b96bd34d724c757737bf40c Mon Sep 17 00:00:00 2001 From: Gonk Date: Thu, 11 Jul 2019 21:28:31 +0200 Subject: [PATCH 2/2] adjusted sorting of skills - until now the ordinal value of the skill id was used as default sort order. Since the ordinals are stored in the savegames inserting new skills was only possible at the end of the list. - skills now have a position member that determines the default sort order - now using a linkedhashmap for storing the skills. this map allows iterating in the order in which the values were inserted - switching back to "unsorted" restores the default sort order - changed the order for the pole weapon proficency to be behind the other weapon proficiencies --- .../fragment/HeroinfoActivity_Skills.java | 2 +- .../model/ability/SkillCollection.java | 92 ++++++++++--------- .../AndorsTrail/model/ability/SkillInfo.java | 3 + .../AndorsTrail/view/SkillListAdapter.java | 14 ++- 4 files changed, 63 insertions(+), 48 deletions(-) diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/fragment/HeroinfoActivity_Skills.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/fragment/HeroinfoActivity_Skills.java index 6d3a3275e..1d6b6511f 100644 --- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/fragment/HeroinfoActivity_Skills.java +++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/fragment/HeroinfoActivity_Skills.java @@ -108,7 +108,7 @@ public final class HeroinfoActivity_Skills extends Fragment { private void reloadShownSort() { int v = world.model.uiSelections.selectedSkillSort; - if(v ==0); + if(v==0) getCurrentCategoryAdapter().sortDefault(); if(v==1) getCurrentCategoryAdapter().sortByName(); if(v==2) getCurrentCategoryAdapter().sortByPoints(); if(v==3) getCurrentCategoryAdapter().sortByUnlocked(); diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/ability/SkillCollection.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/ability/SkillCollection.java index 7479aa029..faa23dbdc 100644 --- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/ability/SkillCollection.java +++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/ability/SkillCollection.java @@ -2,6 +2,7 @@ package com.gpl.rpg.AndorsTrail.model.ability; import java.util.ArrayList; import java.util.Collection; +import java.util.LinkedHashMap; import android.util.SparseArray; @@ -135,104 +136,105 @@ public final class SkillCollection { public static final int MAX_LEVEL_LOWER_EXPLOSS = 100 / PER_SKILLPOINT_INCREASE_EXPLOSS_PERCENT; public static final int MAX_LEVEL_RESISTANCE = 70 / PER_SKILLPOINT_INCREASE_RESISTANCE_CHANCE_PERCENT; - private final SparseArray skills = new SparseArray(); + private final LinkedHashMap skills = new LinkedHashMap(); private void initializeSkill(SkillInfo skill) { skills.put(skill.id.ordinal(), skill); } public void initialize() { - initializeSkill(new SkillInfo(SkillID.weaponChance, SkillInfo.MAXLEVEL_NONE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.offense, null)); - initializeSkill(new SkillInfo(SkillID.weaponDmg, SkillInfo.MAXLEVEL_NONE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.offense, null)); - initializeSkill(new SkillInfo(SkillID.barter, MAX_LEVEL_BARTER, SkillInfo.LevelUpType.alwaysShown, SkillCategory.utility, null)); - initializeSkill(new SkillInfo(SkillID.dodge, SkillInfo.MAXLEVEL_NONE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.defense, null)); + int position = 0; + initializeSkill(new SkillInfo(SkillID.weaponChance, SkillInfo.MAXLEVEL_NONE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.offense, null, position++)); + initializeSkill(new SkillInfo(SkillID.weaponDmg, SkillInfo.MAXLEVEL_NONE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.offense, null, position++)); + initializeSkill(new SkillInfo(SkillID.barter, MAX_LEVEL_BARTER, SkillInfo.LevelUpType.alwaysShown, SkillCategory.utility, null, position++)); + initializeSkill(new SkillInfo(SkillID.dodge, SkillInfo.MAXLEVEL_NONE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.defense, null, position++)); initializeSkill(new SkillInfo(SkillID.barkSkin, MAX_LEVEL_BARKSKIN, SkillInfo.LevelUpType.alwaysShown, SkillCategory.defense, new SkillLevelRequirement[] { SkillLevelRequirement.requireExperienceLevels(10, 0) ,SkillLevelRequirement.requirePlayerStats(Player.StatID.blockChance, 15, 0) - })); - initializeSkill(new SkillInfo(SkillID.moreCriticals, SkillInfo.MAXLEVEL_NONE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.criticals, null)); + }, position++)); + initializeSkill(new SkillInfo(SkillID.moreCriticals, SkillInfo.MAXLEVEL_NONE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.criticals, null, position++)); initializeSkill(new SkillInfo(SkillID.betterCriticals, SkillInfo.MAXLEVEL_NONE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.criticals, new SkillLevelRequirement[] { SkillLevelRequirement.requireOtherSkill(SkillID.moreCriticals, 1) - })); + }, position++)); initializeSkill(new SkillInfo(SkillID.speed, MAX_LEVEL_SPEED, SkillInfo.LevelUpType.alwaysShown, SkillCategory.offense, new SkillLevelRequirement[] { SkillLevelRequirement.requireExperienceLevels(15, 0) - })); - initializeSkill(new SkillInfo(SkillID.coinfinder, SkillInfo.MAXLEVEL_NONE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.utility, null)); - initializeSkill(new SkillInfo(SkillID.moreExp, SkillInfo.MAXLEVEL_NONE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.utility, null)); + }, position++)); + initializeSkill(new SkillInfo(SkillID.coinfinder, SkillInfo.MAXLEVEL_NONE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.utility, null, position++)); + initializeSkill(new SkillInfo(SkillID.moreExp, SkillInfo.MAXLEVEL_NONE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.utility, null, position++)); initializeSkill(new SkillInfo(SkillID.cleave, SkillInfo.MAXLEVEL_NONE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.offense, new SkillLevelRequirement[] { SkillLevelRequirement.requireOtherSkill(SkillID.weaponChance, 1) ,SkillLevelRequirement.requireOtherSkill(SkillID.weaponDmg, 1) - })); + }, position++)); initializeSkill(new SkillInfo(SkillID.eater, SkillInfo.MAXLEVEL_NONE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.immunity, new SkillLevelRequirement[] { SkillLevelRequirement.requirePlayerStats(Player.StatID.maxHP, 20, 20) - })); + }, position++)); initializeSkill(new SkillInfo(SkillID.fortitude, SkillInfo.MAXLEVEL_NONE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.immunity, new SkillLevelRequirement[] { SkillLevelRequirement.requireExperienceLevels(15, -10) - })); - initializeSkill(new SkillInfo(SkillID.evasion, MAX_LEVEL_EVASION, SkillInfo.LevelUpType.alwaysShown, SkillCategory.defense, null)); + }, position++)); + initializeSkill(new SkillInfo(SkillID.evasion, MAX_LEVEL_EVASION, SkillInfo.LevelUpType.alwaysShown, SkillCategory.defense, null, position++)); initializeSkill(new SkillInfo(SkillID.regeneration, SkillInfo.MAXLEVEL_NONE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.immunity, new SkillLevelRequirement[] { SkillLevelRequirement.requirePlayerStats(Player.StatID.maxHP, 30, 0) ,SkillLevelRequirement.requireOtherSkill(SkillID.fortitude, 1) - })); - initializeSkill(new SkillInfo(SkillID.lowerExploss, MAX_LEVEL_LOWER_EXPLOSS, SkillInfo.LevelUpType.alwaysShown, SkillCategory.utility, null)); - initializeSkill(new SkillInfo(SkillID.magicfinder, SkillInfo.MAXLEVEL_NONE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.utility, null)); - initializeSkill(new SkillInfo(SkillID.resistanceMental, MAX_LEVEL_RESISTANCE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.immunity, null)); - initializeSkill(new SkillInfo(SkillID.resistancePhysical, MAX_LEVEL_RESISTANCE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.immunity, null)); - initializeSkill(new SkillInfo(SkillID.resistanceBlood, MAX_LEVEL_RESISTANCE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.immunity, null)); - initializeSkill(new SkillInfo(SkillID.shadowBless, 1, SkillInfo.LevelUpType.onlyByQuests, SkillCategory.immunity, null)); + }, position++)); + initializeSkill(new SkillInfo(SkillID.lowerExploss, MAX_LEVEL_LOWER_EXPLOSS, SkillInfo.LevelUpType.alwaysShown, SkillCategory.utility, null, position++)); + initializeSkill(new SkillInfo(SkillID.magicfinder, SkillInfo.MAXLEVEL_NONE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.utility, null, position++)); + initializeSkill(new SkillInfo(SkillID.resistanceMental, MAX_LEVEL_RESISTANCE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.immunity, null, position++)); + initializeSkill(new SkillInfo(SkillID.resistancePhysical, MAX_LEVEL_RESISTANCE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.immunity, null, position++)); + initializeSkill(new SkillInfo(SkillID.resistanceBlood, MAX_LEVEL_RESISTANCE, SkillInfo.LevelUpType.alwaysShown, SkillCategory.immunity, null, position++)); + initializeSkill(new SkillInfo(SkillID.shadowBless, 1, SkillInfo.LevelUpType.onlyByQuests, SkillCategory.immunity, null, position++)); initializeSkill(new SkillInfo(SkillID.crit1, 1, SkillInfo.LevelUpType.alwaysShown, SkillCategory.criticals, new SkillLevelRequirement[] { SkillLevelRequirement.requireOtherSkill(SkillID.moreCriticals, 3) ,SkillLevelRequirement.requireOtherSkill(SkillID.betterCriticals, 3) - })); + }, position++)); initializeSkill(new SkillInfo(SkillID.crit2, 1, SkillInfo.LevelUpType.alwaysShown, SkillCategory.criticals, new SkillLevelRequirement[] { SkillLevelRequirement.requireOtherSkill(SkillID.moreCriticals, 6) ,SkillLevelRequirement.requireOtherSkill(SkillID.betterCriticals, 6) ,SkillLevelRequirement.requireOtherSkill(SkillID.crit1, 1) - })); + }, position++)); initializeSkill(new SkillInfo(SkillID.rejuvenation, 1, SkillInfo.LevelUpType.alwaysShown, SkillCategory.immunity, new SkillLevelRequirement[] { SkillLevelRequirement.requireOtherSkill(SkillID.resistanceBlood, 3) ,SkillLevelRequirement.requireOtherSkill(SkillID.resistanceMental, 3) ,SkillLevelRequirement.requireOtherSkill(SkillID.resistancePhysical, 3) - })); + }, position++)); initializeSkill(new SkillInfo(SkillID.taunt, 1, SkillInfo.LevelUpType.alwaysShown, SkillCategory.defense, new SkillLevelRequirement[] { SkillLevelRequirement.requireOtherSkill(SkillID.evasion, 2) ,SkillLevelRequirement.requireOtherSkill(SkillID.dodge, 4) - })); + }, position++)); initializeSkill(new SkillInfo(SkillID.concussion, 1, SkillInfo.LevelUpType.alwaysShown, SkillCategory.offense, new SkillLevelRequirement[] { SkillLevelRequirement.requireOtherSkill(SkillID.speed, 2) ,SkillLevelRequirement.requireOtherSkill(SkillID.weaponChance, 3) ,SkillLevelRequirement.requireOtherSkill(SkillID.weaponDmg, 5) - })); - initializeSkill(new SkillInfo(SkillID.weaponProficiencyDagger, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null)); - initializeSkill(new SkillInfo(SkillID.weaponProficiency1hsword, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null)); - initializeSkill(new SkillInfo(SkillID.weaponProficiency2hsword, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null)); - initializeSkill(new SkillInfo(SkillID.weaponProficiencyAxe, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null)); - initializeSkill(new SkillInfo(SkillID.weaponProficiencyBlunt, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null)); - initializeSkill(new SkillInfo(SkillID.weaponProficiencyUnarmed, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null)); - initializeSkill(new SkillInfo(SkillID.weaponProficiencyPole, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null)); - initializeSkill(new SkillInfo(SkillID.armorProficiencyShield, 2, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null)); - initializeSkill(new SkillInfo(SkillID.armorProficiencyUnarmored, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null)); - initializeSkill(new SkillInfo(SkillID.armorProficiencyLight, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null)); - initializeSkill(new SkillInfo(SkillID.armorProficiencyHeavy, 4, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null)); + }, position++)); + initializeSkill(new SkillInfo(SkillID.weaponProficiencyDagger, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null, position++)); + initializeSkill(new SkillInfo(SkillID.weaponProficiency1hsword, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null, position++)); + initializeSkill(new SkillInfo(SkillID.weaponProficiency2hsword, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null, position++)); + initializeSkill(new SkillInfo(SkillID.weaponProficiencyAxe, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null, position++)); + initializeSkill(new SkillInfo(SkillID.weaponProficiencyBlunt, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null, position++)); + initializeSkill(new SkillInfo(SkillID.weaponProficiencyUnarmed, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null, position++)); + initializeSkill(new SkillInfo(SkillID.weaponProficiencyPole, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null, position++)); + initializeSkill(new SkillInfo(SkillID.armorProficiencyShield, 2, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null, position++)); + initializeSkill(new SkillInfo(SkillID.armorProficiencyUnarmored, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null, position++)); + initializeSkill(new SkillInfo(SkillID.armorProficiencyLight, 3, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null, position++)); + initializeSkill(new SkillInfo(SkillID.armorProficiencyHeavy, 4, SkillInfo.LevelUpType.firstLevelRequiresQuest, SkillCategory.proficiency, null, position++)); initializeSkill(new SkillInfo(SkillID.fightstyleDualWield, 2, SkillInfo.LevelUpType.alwaysShown, SkillCategory.specialty, new SkillLevelRequirement[] { SkillLevelRequirement.requireExperienceLevels(15, 0) - })); + }, position++)); initializeSkill(new SkillInfo(SkillID.fightstyle2hand, 2, SkillInfo.LevelUpType.alwaysShown, SkillCategory.specialty, new SkillLevelRequirement[] { SkillLevelRequirement.requireExperienceLevels(15, 0) - })); + }, position++)); initializeSkill(new SkillInfo(SkillID.fightstyleWeaponShield, 2, SkillInfo.LevelUpType.alwaysShown, SkillCategory.specialty, new SkillLevelRequirement[] { SkillLevelRequirement.requireExperienceLevels(15, 0) - })); + }, position++)); initializeSkill(new SkillInfo(SkillID.specializationDualWield, 1, SkillInfo.LevelUpType.alwaysShown, SkillCategory.specialty, new SkillLevelRequirement[] { SkillLevelRequirement.requireExperienceLevels(45, 0) ,SkillLevelRequirement.requireOtherSkill(SkillID.fightstyleDualWield, 2) - })); + }, position++)); initializeSkill(new SkillInfo(SkillID.specialization2hand, 1, SkillInfo.LevelUpType.alwaysShown, SkillCategory.specialty, new SkillLevelRequirement[] { SkillLevelRequirement.requireExperienceLevels(45, 0) ,SkillLevelRequirement.requireOtherSkill(SkillID.fightstyle2hand, 2) - })); + }, position++)); initializeSkill(new SkillInfo(SkillID.specializationWeaponShield, 1, SkillInfo.LevelUpType.alwaysShown, SkillCategory.specialty, new SkillLevelRequirement[] { SkillLevelRequirement.requireExperienceLevels(45, 0) ,SkillLevelRequirement.requireOtherSkill(SkillID.fightstyleWeaponShield, 2) - })); + }, position++)); } public SkillInfo getSkill(SkillID skillID) { @@ -241,7 +243,7 @@ public final class SkillCollection { public Collection getAllSkills() { ArrayList result = new ArrayList(skills.size()); - for(int i = 0; i < skills.size(); ++i) result.add(skills.valueAt(i)); + for(int i = 0; i < skills.size(); ++i) result.add(skills.get(i)); return result; } } diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/ability/SkillInfo.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/ability/SkillInfo.java index 430e1b859..48b0a1081 100644 --- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/ability/SkillInfo.java +++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/ability/SkillInfo.java @@ -15,18 +15,21 @@ public final class SkillInfo { public final LevelUpType levelupVisibility; public final SkillLevelRequirement[] levelupRequirements; public final SkillCollection.SkillCategory categoryType; + public final int position; public SkillInfo( SkillCollection.SkillID id , int maxLevel , LevelUpType levelupVisibility , SkillCollection.SkillCategory categoryType , SkillLevelRequirement[] levelupRequirements + , int position ) { this.id = id; this.maxLevel = maxLevel; this.levelupVisibility = levelupVisibility; this.levelupRequirements = levelupRequirements; this.categoryType = categoryType; + this.position = position; } public boolean hasMaxLevel() { diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/view/SkillListAdapter.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/view/SkillListAdapter.java index 04a9cf728..ec4c2972c 100644 --- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/view/SkillListAdapter.java +++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/view/SkillListAdapter.java @@ -45,7 +45,7 @@ public final class SkillListAdapter extends ArrayAdapter { Collections.sort(result, new Comparator() { @Override public int compare(SkillInfo a, SkillInfo b) { - return a.id.ordinal() - b.id.ordinal(); + return a.position - b.position; } }); return result; @@ -63,7 +63,7 @@ public final class SkillListAdapter extends ArrayAdapter { Collections.sort(result, new Comparator() { @Override public int compare(SkillInfo a, SkillInfo b) { - return a.id.ordinal() - b.id.ordinal(); + return a.position - b.position; } }); return result; @@ -164,6 +164,16 @@ public final class SkillListAdapter extends ArrayAdapter { } } + public void sortDefault(){ + Comparator comparatorName = new Comparator() { + @Override + public int compare(SkillInfo a, SkillInfo b) { + return a.position - b.position; + } + }; + this.sort(comparatorName); + } + public void sortByName(){ Comparator comparatorName = new Comparator() { @Override