Merge branch 'fightstyles' into v070

This commit is contained in:
Oskar Wiksten
2013-06-27 20:42:26 +02:00
7 changed files with 386 additions and 7 deletions

View File

@@ -566,4 +566,65 @@
<string name="conversation_reward_quest_finished">[Quest completed: \"%1$s\"]</string>
<string name="conversation_reward_quest_updated">[Quest updated: \"%1$s\"]</string>
<string name="skill_title_weapon_prof_dagger">Dagger proficiency</string>
<string name="skill_title_weapon_prof_1hsword">One-handed sword proficiency</string>
<string name="skill_title_weapon_prof_2hsword">Two-handed sword proficiency</string>
<string name="skill_title_weapon_prof_axe">Axe proficiency</string>
<string name="skill_title_weapon_prof_blunt">Bludgeoning weapon proficiency</string>
<string name="skill_title_weapon_prof_unarmed">Unarmed fighting</string>
<string name="skill_title_armor_prof_shield">Shield proficiency</string>
<string name="skill_title_armor_prof_unarmored">Unarmored fighting</string>
<string name="skill_title_armor_prof_light">Light armor proficiency</string>
<string name="skill_title_armor_prof_heavy">Heavy armor proficiency</string>
<string name="skill_title_fightstyle_dualwield">Fighting style: Dual wield</string>
<string name="skill_title_fightstyle_2hand">Fighting style: Two-handed weapon</string>
<string name="skill_title_fightstyle_weapon_shield">Fighting style: Weapon and shield</string>
<string name="skill_title_specialization_dualwield">Specialization: Dual wield</string>
<string name="skill_title_specialization_2hand">Specialization: Two-handed weapon</string>
<string name="skill_title_specialization_weapon_shield">Specialization: Weapon and shield</string>
<string name="skill_shortdescription_weapon_prof_dagger">Better at fighting with daggers</string>
<string name="skill_shortdescription_weapon_prof_1hsword">Better at fighting with one-handed swords</string>
<string name="skill_shortdescription_weapon_prof_2hsword">Better at fighting with two-handed swords</string>
<string name="skill_shortdescription_weapon_prof_axe">Better at fighting with axes</string>
<string name="skill_shortdescription_weapon_prof_blunt">Better at fighting with bludgeoning weapons</string>
<string name="skill_shortdescription_weapon_prof_unarmed">Better at fighting without weapons</string>
<string name="skill_shortdescription_armor_prof_shield">Make better use of shields</string>
<string name="skill_shortdescription_armor_prof_unarmored">Better at fighting without armor</string>
<string name="skill_shortdescription_armor_prof_light">Make better use of light armor</string>
<string name="skill_shortdescription_armor_prof_heavy">Make better use of heavy armor</string>
<string name="skill_shortdescription_fightstyle_dualwield">Wield two weapons at the same time</string>
<string name="skill_shortdescription_fightstyle_2hand">Make better use of weapons that require both hands</string>
<string name="skill_shortdescription_fightstyle_weapon_shield">Better at fighting with weapon and shield</string>
<string name="skill_shortdescription_specialization_dualwield">Expert at dual wielding</string>
<string name="skill_shortdescription_specialization_2hand">Expert at two-handed weapons</string>
<string name="skill_shortdescription_specialization_weapon_shield">Expert at fighting with weapon and shield</string>
<string name="skill_longdescription_weapon_prof_dagger">Increases attack chance of daggers and shortswords by %1$d for each level.</string>
<string name="skill_longdescription_weapon_prof_1hsword">Increases attack chance of longswords and broadswords by %1$d for each level.</string>
<string name="skill_longdescription_weapon_prof_2hsword">Increases attack chance of two-handed swords by %1$d for each level.</string>
<string name="skill_longdescription_weapon_prof_axe">Increases attack chance of axes and greataxes by %1$d for each level.</string>
<string name="skill_longdescription_weapon_prof_blunt">Increases attack chance of bludgeoning weapons by %1$d for each level. This includes clubs, quarterstaves, maces, scepters, warhammers and giant hammers.</string>
<string name="skill_longdescription_weapon_prof_unarmed">When fighting without a weapon and shield, gain %1$d attack chance, %2$d damage potential and %3$d block chance per skill level.</string>
<string name="skill_longdescription_armor_prof_shield">Increase damage resistance by %1$d per skill level while having a shield equipped.</string>
<string name="skill_longdescription_armor_prof_unarmored">While fighting without having any armor equipped, gain %1$d block chance per skill level. Items made of cloth are not considered as being armor.</string>
<string name="skill_longdescription_armor_prof_light">For every skill level, increases the block chance of every piece of light armor being worn by %1$d %% of their original block chances. Light armors include leather and light metal.</string>
<string name="skill_longdescription_armor_prof_heavy">For every skill level, increases the block chance of every piece of heavy armor being worn by %1$d %% of their original block chances. Pieces of heavy armor have their movement penalties reduced by %2$d %% per skill level, and their attack speed penalties reduced by %3$d %% per skill level. Heavy armors include metal armors, chain mail and plate mail.</string>
<string name="skill_longdescription_fightstyle_dualwield">"Gives benefits when fighting with two weapons at the same time, one in the main hand and one in the off-hand.
Without this skill, only %1$d %% of a weapon\'s qualities may be used when equipped in the off-hand. This includes attack chance, critical skill, damage potential and block chance. Without this skill, attack speed (AP cost) of making an attack is the sum of the attack speed of the main weapon and that of the weapon used in the off-hand.
With one level of this skill, %2$d %% of the off-hand\'s weapon\'s qualities may be used, and the attack speed is the attack speed of the weapon in the main hand plus %3$d %% of the attack speed of the weapon in the off-hand.
With two levels of this skill, %4$d %% of the off-hand\'s weapon\'s qualities may be used, and the attack speed equals the highest of the attack speeds of the two equipped weapons."</string>
<string name="skill_longdescription_fightstyle_2hand">"Gives benefits when using weapons that require both hands to wield, such as two-handed swords, greataxes or giant hammers.
Every skill level increases damage potential of two-handed weapons with %1$d %% of the original damage potential."</string>
<string name="skill_longdescription_fightstyle_weapon_shield">"Gives benefits when fighting with a weapon in the main hand and having a shield equipped in the off-hand.
Every skill level increases the attack chance of weapons with %1$d %% of their original attack chances, and the block chance of shields by %2$d %% of their original block chances."</string>
<string name="skill_longdescription_specialization_dualwield">Increases the attack chance of both wielded weapons by an additional %1$d %% of their original attack chances, in addition to the benefis given by the weapon style skill. The block chances of both wielded weapons are also increased by %2$d %% of their original block chances.</string>
<string name="skill_longdescription_specialization_2hand">Increases damage potential of two-handed weapons by an additional %1$d %% of the original damage potential, in addition to the benefis given by the weapon style skill. The attack chances of two-handed weapons are also increased by %2$d %% of their original attack chances.</string>
<string name="skill_longdescription_specialization_weapon_shield">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.</string>
</resources>

View File

@@ -13,6 +13,7 @@ import android.app.Activity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.text.Html;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
@@ -133,6 +134,22 @@ public final class SkillInfoActivity extends Activity {
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;
case SkillCollection.SKILL_WEAPON_PROFICIENCY_DAGGER: return R.string.skill_title_weapon_prof_dagger;
case SkillCollection.SKILL_WEAPON_PROFICIENCY_1HSWORD: return R.string.skill_title_weapon_prof_1hsword;
case SkillCollection.SKILL_WEAPON_PROFICIENCY_2HSWORD: return R.string.skill_title_weapon_prof_2hsword;
case SkillCollection.SKILL_WEAPON_PROFICIENCY_AXE: return R.string.skill_title_weapon_prof_axe;
case SkillCollection.SKILL_WEAPON_PROFICIENCY_BLUNT: return R.string.skill_title_weapon_prof_blunt;
case SkillCollection.SKILL_WEAPON_PROFICIENCY_UNARMED: return R.string.skill_title_weapon_prof_unarmed;
case SkillCollection.SKILL_ARMOR_PROFICIENCY_SHIELD: return R.string.skill_title_armor_prof_shield;
case SkillCollection.SKILL_ARMOR_PROFICIENCY_UNARMORED: return R.string.skill_title_armor_prof_unarmored;
case SkillCollection.SKILL_ARMOR_PROFICIENCY_LIGHT: return R.string.skill_title_armor_prof_light;
case SkillCollection.SKILL_ARMOR_PROFICIENCY_HEAVY: return R.string.skill_title_armor_prof_heavy;
case SkillCollection.SKILL_FIGHTSTYLE_DUAL_WIELD: return R.string.skill_title_fightstyle_dualwield;
case SkillCollection.SKILL_FIGHTSTYLE_2HAND: return R.string.skill_title_fightstyle_2hand;
case SkillCollection.SKILL_FIGHTSTYLE_WEAPON_SHIELD: return R.string.skill_title_fightstyle_weapon_shield;
case SkillCollection.SKILL_SPECIALIZATION_DUAL_WIELD: return R.string.skill_title_specialization_dualwield;
case SkillCollection.SKILL_SPECIALIZATION_2HAND: return R.string.skill_title_specialization_2hand;
case SkillCollection.SKILL_SPECIALIZATION_WEAPON_SHIELD: return R.string.skill_title_specialization_weapon_shield;
default:
return -1;
}
@@ -166,6 +183,22 @@ public final class SkillInfoActivity extends Activity {
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);
case SkillCollection.SKILL_WEAPON_PROFICIENCY_DAGGER: return res.getString(R.string.skill_longdescription_weapon_prof_dagger, SkillCollection.PER_SKILLPOINT_INCREASE_WEAPON_PROF_AC);
case SkillCollection.SKILL_WEAPON_PROFICIENCY_1HSWORD: return res.getString(R.string.skill_longdescription_weapon_prof_1hsword, SkillCollection.PER_SKILLPOINT_INCREASE_WEAPON_PROF_AC);
case SkillCollection.SKILL_WEAPON_PROFICIENCY_2HSWORD: return res.getString(R.string.skill_longdescription_weapon_prof_2hsword, SkillCollection.PER_SKILLPOINT_INCREASE_WEAPON_PROF_AC);
case SkillCollection.SKILL_WEAPON_PROFICIENCY_AXE: return res.getString(R.string.skill_longdescription_weapon_prof_axe, SkillCollection.PER_SKILLPOINT_INCREASE_WEAPON_PROF_AC);
case SkillCollection.SKILL_WEAPON_PROFICIENCY_BLUNT: return res.getString(R.string.skill_longdescription_weapon_prof_blunt, SkillCollection.PER_SKILLPOINT_INCREASE_WEAPON_PROF_AC);
case SkillCollection.SKILL_WEAPON_PROFICIENCY_UNARMED: return res.getString(R.string.skill_longdescription_weapon_prof_unarmed, SkillCollection.PER_SKILLPOINT_INCREASE_UNARMED_AC, SkillCollection.PER_SKILLPOINT_INCREASE_UNARMED_DMG, SkillCollection.PER_SKILLPOINT_INCREASE_UNARMED_BC);
case SkillCollection.SKILL_ARMOR_PROFICIENCY_SHIELD: return res.getString(R.string.skill_longdescription_armor_prof_shield, SkillCollection.PER_SKILLPOINT_INCREASE_SHIELD_PROF_DR);
case SkillCollection.SKILL_ARMOR_PROFICIENCY_UNARMORED: return res.getString(R.string.skill_longdescription_armor_prof_unarmored, SkillCollection.PER_SKILLPOINT_INCREASE_UNARMORED_BC);
case SkillCollection.SKILL_ARMOR_PROFICIENCY_LIGHT: return res.getString(R.string.skill_longdescription_armor_prof_light, SkillCollection.PER_SKILLPOINT_INCREASE_LIGHT_ARMOR_BC_PERCENT);
case SkillCollection.SKILL_ARMOR_PROFICIENCY_HEAVY: return res.getString(R.string.skill_longdescription_armor_prof_heavy, SkillCollection.PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_BC_PERCENT, SkillCollection.PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_MOVECOST_PERCENT, SkillCollection.PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_ATKCOST_PERCENT);
case SkillCollection.SKILL_FIGHTSTYLE_DUAL_WIELD: return res.getString(R.string.skill_longdescription_fightstyle_dualwield, SkillCollection.DUALWIELD_EFFICIENCY_LEVEL0, SkillCollection.DUALWIELD_EFFICIENCY_LEVEL1, SkillCollection.DUALWIELD_LEVEL1_OFFHAND_AP_COST_PERCENT, SkillCollection.DUALWIELD_EFFICIENCY_LEVEL2);
case SkillCollection.SKILL_FIGHTSTYLE_2HAND: return res.getString(R.string.skill_longdescription_fightstyle_2hand, SkillCollection.PER_SKILLPOINT_INCREASE_FIGHTSTYLE_2HAND_DMG_PERCENT);
case SkillCollection.SKILL_FIGHTSTYLE_WEAPON_SHIELD: return res.getString(R.string.skill_longdescription_fightstyle_weapon_shield, SkillCollection.PER_SKILLPOINT_INCREASE_FIGHTSTYLE_WEAPON_AC_PERCENT, SkillCollection.PER_SKILLPOINT_INCREASE_FIGHTSTYLE_SHIELD_BC_PERCENT);
case SkillCollection.SKILL_SPECIALIZATION_DUAL_WIELD: 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 SkillCollection.SKILL_SPECIALIZATION_2HAND: 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 SkillCollection.SKILL_SPECIALIZATION_WEAPON_SHIELD: 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);
default:
return "";
}

View File

@@ -144,7 +144,7 @@ public final class ItemController {
SkillController.applySkillEffectsFromItemProficiencies(player);
SkillController.applySkillEffectsFromFightingStyles(player);
}
private static ItemType getMainWeapon(Player player) {
public static ItemType getMainWeapon(Player player) {
ItemType itemType = player.inventory.wear[Inventory.WEARSLOT_WEAPON];
if (itemType != null) return itemType;
itemType = player.inventory.wear[Inventory.WEARSLOT_SHIELD];

View File

@@ -1,15 +1,20 @@
package com.gpl.rpg.AndorsTrail.controller;
import com.gpl.rpg.AndorsTrail.context.ControllerContext;
import android.util.FloatMath;
import com.gpl.rpg.AndorsTrail.context.WorldContext;
import com.gpl.rpg.AndorsTrail.model.AttackResult;
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.ability.traits.AbilityModifierTraits;
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.Inventory;
import com.gpl.rpg.AndorsTrail.model.item.ItemCategory;
import com.gpl.rpg.AndorsTrail.model.item.ItemType;
import com.gpl.rpg.AndorsTrail.model.item.ItemTypeCollection;
import com.gpl.rpg.AndorsTrail.model.item.DropList.DropItem;
@@ -187,12 +192,205 @@ public final class SkillController {
}
public static void applySkillEffectsFromItemProficiencies(Player player) {
Player playerTraits = player;
ItemType mainWeapon = ItemController.getMainWeapon(player);
if (mainWeapon != null) {
playerTraits.attackChance += SkillCollection.PER_SKILLPOINT_INCREASE_WEAPON_PROF_AC * getSkillLevelForItemType(player, mainWeapon);
}
final int unarmedLevel = player.getSkillLevel(SkillCollection.SKILL_WEAPON_PROFICIENCY_UNARMED);
if (unarmedLevel > 0) {
if (isUnarmed(player)) {
playerTraits.attackChance += SkillCollection.PER_SKILLPOINT_INCREASE_UNARMED_AC * unarmedLevel;
playerTraits.damagePotential.addToMax(SkillCollection.PER_SKILLPOINT_INCREASE_UNARMED_DMG * unarmedLevel);
playerTraits.damagePotential.add(SkillCollection.PER_SKILLPOINT_INCREASE_UNARMED_DMG * unarmedLevel, false);
playerTraits.blockChance += SkillCollection.PER_SKILLPOINT_INCREASE_UNARMED_BC * unarmedLevel;
}
}
ItemType shield = player.inventory.wear[Inventory.WEARSLOT_SHIELD];
if (shield != null && shield.isShield()) {
playerTraits.damageResistance += SkillCollection.PER_SKILLPOINT_INCREASE_SHIELD_PROF_DR * getSkillLevelForItemType(player, shield);
}
final int unarmoredLevel = player.getSkillLevel(SkillCollection.SKILL_ARMOR_PROFICIENCY_UNARMORED);
if (unarmoredLevel > 0) {
if (isUnarmored(player)) {
playerTraits.blockChance += SkillCollection.PER_SKILLPOINT_INCREASE_UNARMORED_BC * unarmoredLevel;
}
}
int skillLevelLightArmor = player.getSkillLevel(SkillCollection.SKILL_ARMOR_PROFICIENCY_LIGHT);
int skillLevelHeavyArmor = player.getSkillLevel(SkillCollection.SKILL_ARMOR_PROFICIENCY_HEAVY);
for (int slot = 0; slot < Inventory.NUM_WORN_SLOTS; ++slot) {
if (!Inventory.isArmorSlot(slot)) continue;
ItemType itemType = player.inventory.wear[slot];
if (itemType == null) continue;
if (itemType.effects_equip == null) continue;
int skill = getProficiencySkillForItemCategory(itemType.category);
if (skill == SkillCollection.SKILL_ARMOR_PROFICIENCY_LIGHT) {
if (skillLevelLightArmor > 0) {
playerTraits.blockChance += getPercentage(itemType.effects_equip.stats.increaseBlockChance, SkillCollection.PER_SKILLPOINT_INCREASE_LIGHT_ARMOR_BC_PERCENT * skillLevelLightArmor);
}
} else if (skill == SkillCollection.SKILL_ARMOR_PROFICIENCY_HEAVY) {
if (skillLevelHeavyArmor > 0) {
playerTraits.blockChance += getPercentage(itemType.effects_equip.stats.increaseBlockChance, SkillCollection.PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_BC_PERCENT * skillLevelHeavyArmor);
playerTraits.moveCost -= getPercentage(itemType.effects_equip.stats.increaseMoveCost, SkillCollection.PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_MOVECOST_PERCENT * skillLevelHeavyArmor);
playerTraits.attackCost -= getPercentage(itemType.effects_equip.stats.increaseAttackCost, SkillCollection.PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_ATKCOST_PERCENT * skillLevelHeavyArmor);
}
}
}
}
private static boolean isUnarmed(Player player) {
if (hasItemWithWeight(player, Inventory.WEARSLOT_WEAPON)) return false;
if (hasItemWithWeight(player, Inventory.WEARSLOT_SHIELD)) return false;
return true;
}
private static boolean isUnarmored(Player player) {
for (int slot = 0; slot < Inventory.NUM_WORN_SLOTS; ++slot) {
if (!Inventory.isArmorSlot(slot)) continue;
if (hasItemWithWeight(player, slot)) return false;
}
return true;
}
private static boolean hasItemWithWeight(Player player, int slot) {
ItemType itemType = player.inventory.wear[slot];
if (itemType == null) return false;
if (itemType.category.getSize() == ItemCategory.SIZE_NONE) return false;
return true;
}
private static int getSkillLevelForItemType(final Player player, ItemType itemType) {
int skill = getProficiencySkillForItemCategory(itemType.category);
if (skill == -1) return 0;
return player.getSkillLevel(skill);
}
private static int getProficiencySkillForItemCategory(ItemCategory category) {
final String itemCategoryID = category.id;
if (category.isWeapon()) {
if (itemCategoryID.equals("dagger") || itemCategoryID.equals("ssword"))
return SkillCollection.SKILL_WEAPON_PROFICIENCY_DAGGER;
else if (itemCategoryID.equals("lsword") || itemCategoryID.equals("bsword"))
return SkillCollection.SKILL_WEAPON_PROFICIENCY_1HSWORD;
else if (itemCategoryID.equals("2hsword"))
return SkillCollection.SKILL_WEAPON_PROFICIENCY_2HSWORD;
else if (itemCategoryID.equals("axe") || itemCategoryID.equals("axe2h"))
return SkillCollection.SKILL_WEAPON_PROFICIENCY_AXE;
else if (itemCategoryID.equals("club") || itemCategoryID.equals("staff") || itemCategoryID.equals("mace")
|| itemCategoryID.equals("scepter") || itemCategoryID.equals("hammer") || itemCategoryID.equals("hammer2h"))
return SkillCollection.SKILL_WEAPON_PROFICIENCY_BLUNT;
} else if (category.isShield()) {
return SkillCollection.SKILL_ARMOR_PROFICIENCY_SHIELD;
} else if (category.isArmor()) {
int size = category.getSize();
if (size == ItemCategory.SIZE_LIGHT) return SkillCollection.SKILL_ARMOR_PROFICIENCY_LIGHT;
if (size == ItemCategory.SIZE_STD) return SkillCollection.SKILL_ARMOR_PROFICIENCY_LIGHT;
if (size == ItemCategory.SIZE_LARGE) return SkillCollection.SKILL_ARMOR_PROFICIENCY_HEAVY;
}
return -1;
}
public static void applySkillEffectsFromFightingStyles(Player player) {
Player playerTraits = player;
ItemType mainHandItem = player.inventory.wear[Inventory.WEARSLOT_WEAPON];
ItemType offHandItem = player.inventory.wear[Inventory.WEARSLOT_SHIELD];
if (isWielding2HandItem(mainHandItem, offHandItem)) {
int skillLevelFightStyle = player.getSkillLevel(SkillCollection.SKILL_FIGHTSTYLE_2HAND);
int skillLevelSpecialization = player.getSkillLevel(SkillCollection.SKILL_SPECIALIZATION_2HAND);
addPercentDamage(playerTraits, mainHandItem, skillLevelFightStyle * SkillCollection.PER_SKILLPOINT_INCREASE_FIGHTSTYLE_2HAND_DMG_PERCENT);
addPercentDamage(playerTraits, mainHandItem, skillLevelSpecialization * SkillCollection.PER_SKILLPOINT_INCREASE_SPECIALIZATION_2HAND_DMG_PERCENT);
addPercentAttackChance(playerTraits, mainHandItem, skillLevelSpecialization * SkillCollection.PER_SKILLPOINT_INCREASE_SPECIALIZATION_2HAND_AC_PERCENT);
}
if (isWieldingWeaponAndShield(mainHandItem, offHandItem)) {
int skillLevelFightStyle = player.getSkillLevel(SkillCollection.SKILL_FIGHTSTYLE_WEAPON_SHIELD);
int skillLevelSpecialization = player.getSkillLevel(SkillCollection.SKILL_SPECIALIZATION_WEAPON_SHIELD);
addPercentAttackChance(playerTraits, mainHandItem, skillLevelFightStyle * SkillCollection.PER_SKILLPOINT_INCREASE_FIGHTSTYLE_WEAPON_AC_PERCENT);
addPercentBlockChance(playerTraits, offHandItem, skillLevelFightStyle * SkillCollection.PER_SKILLPOINT_INCREASE_FIGHTSTYLE_SHIELD_BC_PERCENT);
addPercentAttackChance(playerTraits, mainHandItem, skillLevelSpecialization * SkillCollection.PER_SKILLPOINT_INCREASE_SPECIALIZATION_WEAPON_AC_PERCENT);
addPercentDamage(playerTraits, mainHandItem, skillLevelSpecialization * SkillCollection.PER_SKILLPOINT_INCREASE_SPECIALIZATION_WEAPON_DMG_PERCENT);
}
if (isDualWielding(mainHandItem, offHandItem)) {
int skillLevelFightStyle = player.getSkillLevel(SkillCollection.SKILL_FIGHTSTYLE_DUAL_WIELD);
if (offHandItem.effects_equip != null) {
AbilityModifierTraits offHandCombatTraits = offHandItem.effects_equip.stats;
int attackCostMainHand = mainHandItem.effects_equip.stats.increaseAttackCost;
int percent;
if (skillLevelFightStyle == 2) {
percent = SkillCollection.DUALWIELD_EFFICIENCY_LEVEL2;
playerTraits.attackCost = Math.max(attackCostMainHand, offHandCombatTraits.increaseAttackCost);
} else if (skillLevelFightStyle == 1) {
percent = SkillCollection.DUALWIELD_EFFICIENCY_LEVEL1;
playerTraits.attackCost = attackCostMainHand + getPercentage(offHandCombatTraits.increaseAttackCost, SkillCollection.DUALWIELD_LEVEL1_OFFHAND_AP_COST_PERCENT);
} else {
percent = SkillCollection.DUALWIELD_EFFICIENCY_LEVEL0;
playerTraits.attackCost = attackCostMainHand + offHandCombatTraits.increaseAttackCost;
}
int attackChance = offHandCombatTraits.increaseAttackChance;
attackChance += SkillCollection.PER_SKILLPOINT_INCREASE_WEAPON_PROF_AC * getSkillLevelForItemType(player, offHandItem);
playerTraits.attackChance += (int) FloatMath.floor(attackChance * percent / 100.0f);
playerTraits.blockChance += (int) FloatMath.floor(offHandCombatTraits.increaseBlockChance * percent / 100.0f);
playerTraits.damagePotential.addToMax((int) FloatMath.floor(offHandCombatTraits.increaseMaxDamage * percent / 100.0f));
playerTraits.damagePotential.add((int) FloatMath.floor(offHandCombatTraits.increaseMinDamage * percent / 100.0f), false);
playerTraits.criticalSkill += (int) FloatMath.floor(offHandCombatTraits.increaseCriticalSkill * percent / 100.0f);
}
int skillLevelSpecialization = player.getSkillLevel(SkillCollection.SKILL_SPECIALIZATION_DUAL_WIELD);
addPercentAttackChance(playerTraits, mainHandItem, skillLevelSpecialization * SkillCollection.PER_SKILLPOINT_INCREASE_SPECIALIZATION_DUALWIELD_AC_PERCENT);
addPercentBlockChance(playerTraits, mainHandItem, skillLevelSpecialization * SkillCollection.PER_SKILLPOINT_INCREASE_SPECIALIZATION_DUALWIELD_BC_PERCENT);
addPercentAttackChance(playerTraits, offHandItem, skillLevelSpecialization * SkillCollection.PER_SKILLPOINT_INCREASE_SPECIALIZATION_DUALWIELD_AC_PERCENT);
addPercentBlockChance(playerTraits, offHandItem, skillLevelSpecialization * SkillCollection.PER_SKILLPOINT_INCREASE_SPECIALIZATION_DUALWIELD_BC_PERCENT);
}
}
private static void addPercentAttackChance(Player player, ItemType itemType, int percentToAdd) {
if (itemType.effects_equip == null) return;
if (percentToAdd == 0) return;
player.attackChance += getPercentage(itemType.effects_equip.stats.increaseAttackChance, percentToAdd);
}
private static void addPercentBlockChance(Player player, ItemType itemType, int percentToAdd) {
if (itemType.effects_equip == null) return;
if (percentToAdd == 0) return;
player.blockChance += getPercentage(itemType.effects_equip.stats.increaseBlockChance, percentToAdd);
}
private static void addPercentDamage(Player player, ItemType itemType, int percentToAdd) {
if (itemType.effects_equip == null) return;
if (percentToAdd == 0) return;
player.damagePotential.addToMax(getPercentage(itemType.effects_equip.stats.increaseMaxDamage, percentToAdd));
player.damagePotential.add(getPercentage(itemType.effects_equip.stats.increaseMinDamage, percentToAdd), false);
}
private static int getPercentage(int originalValue, int percentToAdd) {
if (originalValue <= 0) return 0;
return (int) FloatMath.floor(originalValue * percentToAdd / 100.0f);
}
public static boolean isDualWielding(ItemType mainHandItem, ItemType offHandItem) {
return false;
if (mainHandItem == null) return false;
if (offHandItem == null) return false;
return mainHandItem.isWeapon() && offHandItem.isWeapon();
}
private static boolean isWielding2HandItem(ItemType mainHandItem, ItemType offHandItem) {
if (mainHandItem == null) return false;
if (offHandItem != null) return false;
return mainHandItem.isTwohandWeapon();
}
private static boolean isWieldingWeaponAndShield(ItemType mainHandItem, ItemType offHandItem) {
if (mainHandItem == null) return false;
if (offHandItem == null) return false;
return mainHandItem.isWeapon() && offHandItem.isShield();
}
}

View File

@@ -36,8 +36,24 @@ public final class SkillCollection {
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 SKILL_WEAPON_PROFICIENCY_DAGGER = 26;
public static final int SKILL_WEAPON_PROFICIENCY_1HSWORD = 27;
public static final int SKILL_WEAPON_PROFICIENCY_2HSWORD = 28;
public static final int SKILL_WEAPON_PROFICIENCY_AXE = 29;
public static final int SKILL_WEAPON_PROFICIENCY_BLUNT = 30;
public static final int SKILL_WEAPON_PROFICIENCY_UNARMED = 31;
public static final int SKILL_ARMOR_PROFICIENCY_SHIELD = 32;
public static final int SKILL_ARMOR_PROFICIENCY_UNARMORED = 33;
public static final int SKILL_ARMOR_PROFICIENCY_LIGHT = 34;
public static final int SKILL_ARMOR_PROFICIENCY_HEAVY = 35;
public static final int SKILL_FIGHTSTYLE_DUAL_WIELD = 36;
public static final int SKILL_FIGHTSTYLE_2HAND = 37;
public static final int SKILL_FIGHTSTYLE_WEAPON_SHIELD = 38;
public static final int SKILL_SPECIALIZATION_DUAL_WIELD = 39;
public static final int SKILL_SPECIALIZATION_2HAND = 40;
public static final int SKILL_SPECIALIZATION_WEAPON_SHIELD = 41;
public static final int NUM_SKILLS = SKILL_CONCUSSION + 1;
public static final int NUM_SKILLS = SKILL_SPECIALIZATION_WEAPON_SHIELD + 1;
public static final int PER_SKILLPOINT_INCREASE_WEAPON_CHANCE = 12;
public static final int PER_SKILLPOINT_INCREASE_WEAPON_DAMAGE_MAX = 1;
@@ -68,6 +84,29 @@ public final class SkillCollection {
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 PER_SKILLPOINT_INCREASE_WEAPON_PROF_AC = 10;
public static final int PER_SKILLPOINT_INCREASE_UNARMED_AC = 20;
public static final int PER_SKILLPOINT_INCREASE_UNARMED_DMG = 2;
public static final int PER_SKILLPOINT_INCREASE_UNARMED_BC = 5;
public static final int PER_SKILLPOINT_INCREASE_SHIELD_PROF_DR = 1;
public static final int PER_SKILLPOINT_INCREASE_UNARMORED_BC = 10;
public static final int PER_SKILLPOINT_INCREASE_LIGHT_ARMOR_BC_PERCENT = 30;
public static final int PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_BC_PERCENT = 10;
public static final int PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_MOVECOST_PERCENT = 25;
public static final int PER_SKILLPOINT_INCREASE_HEAVY_ARMOR_ATKCOST_PERCENT = 25;
public static final int PER_SKILLPOINT_INCREASE_FIGHTSTYLE_2HAND_DMG_PERCENT = 50;
public static final int PER_SKILLPOINT_INCREASE_SPECIALIZATION_2HAND_DMG_PERCENT = 50;
public static final int PER_SKILLPOINT_INCREASE_SPECIALIZATION_2HAND_AC_PERCENT = 20;
public static final int PER_SKILLPOINT_INCREASE_FIGHTSTYLE_WEAPON_AC_PERCENT = 50;
public static final int PER_SKILLPOINT_INCREASE_FIGHTSTYLE_SHIELD_BC_PERCENT = 50;
public static final int PER_SKILLPOINT_INCREASE_SPECIALIZATION_WEAPON_AC_PERCENT = 50;
public static final int PER_SKILLPOINT_INCREASE_SPECIALIZATION_WEAPON_DMG_PERCENT = 20;
public static final int DUALWIELD_EFFICIENCY_LEVEL2 = 100;
public static final int DUALWIELD_EFFICIENCY_LEVEL1 = 50;
public static final int DUALWIELD_EFFICIENCY_LEVEL0 = 25;
public static final int DUALWIELD_LEVEL1_OFFHAND_AP_COST_PERCENT = 50;
public static final int PER_SKILLPOINT_INCREASE_SPECIALIZATION_DUALWIELD_AC_PERCENT = 50;
public static final int PER_SKILLPOINT_INCREASE_SPECIALIZATION_DUALWIELD_BC_PERCENT = 50;
private static final int MAX_LEVEL_BARTER = (int) Math.floor((float) Constants.MARKET_PRICEFACTOR_PERCENT / PER_SKILLPOINT_INCREASE_BARTER_PRICEFACTOR_PERCENTAGE);
private static final int MAX_LEVEL_BARKSKIN = 5;
@@ -145,6 +184,37 @@ public final class SkillCollection {
,SkillLevelRequirement.requireOtherSkill(SKILL_WEAPON_CHANCE, 3)
,SkillLevelRequirement.requireOtherSkill(SKILL_WEAPON_DMG, 5)
}));
initializeSkill(new SkillInfo(SKILL_WEAPON_PROFICIENCY_DAGGER, 3, SkillInfo.LEVELUP_TYPE_FIRST_LEVEL_REQUIRES_QUEST, null));
initializeSkill(new SkillInfo(SKILL_WEAPON_PROFICIENCY_1HSWORD, 3, SkillInfo.LEVELUP_TYPE_FIRST_LEVEL_REQUIRES_QUEST, null));
initializeSkill(new SkillInfo(SKILL_WEAPON_PROFICIENCY_2HSWORD, 3, SkillInfo.LEVELUP_TYPE_FIRST_LEVEL_REQUIRES_QUEST, null));
initializeSkill(new SkillInfo(SKILL_WEAPON_PROFICIENCY_AXE, 3, SkillInfo.LEVELUP_TYPE_FIRST_LEVEL_REQUIRES_QUEST, null));
initializeSkill(new SkillInfo(SKILL_WEAPON_PROFICIENCY_BLUNT, 3, SkillInfo.LEVELUP_TYPE_FIRST_LEVEL_REQUIRES_QUEST, null));
initializeSkill(new SkillInfo(SKILL_WEAPON_PROFICIENCY_UNARMED, 3, SkillInfo.LEVELUP_TYPE_FIRST_LEVEL_REQUIRES_QUEST, null));
initializeSkill(new SkillInfo(SKILL_ARMOR_PROFICIENCY_SHIELD, 2, SkillInfo.LEVELUP_TYPE_FIRST_LEVEL_REQUIRES_QUEST, null));
initializeSkill(new SkillInfo(SKILL_ARMOR_PROFICIENCY_UNARMORED, 3, SkillInfo.LEVELUP_TYPE_FIRST_LEVEL_REQUIRES_QUEST, null));
initializeSkill(new SkillInfo(SKILL_ARMOR_PROFICIENCY_LIGHT, 3, SkillInfo.LEVELUP_TYPE_FIRST_LEVEL_REQUIRES_QUEST, null));
initializeSkill(new SkillInfo(SKILL_ARMOR_PROFICIENCY_HEAVY, 4, SkillInfo.LEVELUP_TYPE_FIRST_LEVEL_REQUIRES_QUEST, null));
initializeSkill(new SkillInfo(SKILL_FIGHTSTYLE_DUAL_WIELD, 2, SkillInfo.LEVELUP_TYPE_ALWAYS_SHOWN, new SkillLevelRequirement[] {
SkillLevelRequirement.requireExperienceLevels(15, 0)
}));
initializeSkill(new SkillInfo(SKILL_FIGHTSTYLE_2HAND, 2, SkillInfo.LEVELUP_TYPE_ALWAYS_SHOWN, new SkillLevelRequirement[] {
SkillLevelRequirement.requireExperienceLevels(15, 0)
}));
initializeSkill(new SkillInfo(SKILL_FIGHTSTYLE_WEAPON_SHIELD, 2, SkillInfo.LEVELUP_TYPE_ALWAYS_SHOWN, new SkillLevelRequirement[] {
SkillLevelRequirement.requireExperienceLevels(15, 0)
}));
initializeSkill(new SkillInfo(SKILL_SPECIALIZATION_DUAL_WIELD, 1, SkillInfo.LEVELUP_TYPE_ALWAYS_SHOWN, new SkillLevelRequirement[] {
SkillLevelRequirement.requireExperienceLevels(45, 0)
,SkillLevelRequirement.requireOtherSkill(SKILL_FIGHTSTYLE_DUAL_WIELD, 2)
}));
initializeSkill(new SkillInfo(SKILL_SPECIALIZATION_2HAND, 1, SkillInfo.LEVELUP_TYPE_ALWAYS_SHOWN, new SkillLevelRequirement[] {
SkillLevelRequirement.requireExperienceLevels(45, 0)
,SkillLevelRequirement.requireOtherSkill(SKILL_FIGHTSTYLE_2HAND, 2)
}));
initializeSkill(new SkillInfo(SKILL_SPECIALIZATION_WEAPON_SHIELD, 1, SkillInfo.LEVELUP_TYPE_ALWAYS_SHOWN, new SkillLevelRequirement[] {
SkillLevelRequirement.requireExperienceLevels(45, 0)
,SkillLevelRequirement.requireOtherSkill(SKILL_FIGHTSTYLE_WEAPON_SHIELD, 2)
}));
}
public SkillInfo getSkill(int skillID) {

View File

@@ -23,20 +23,21 @@ public final class ItemCategory {
private static final int ACTIONTYPE_NONE = 0;
private static final int ACTIONTYPE_USE = 1;
private static final int ACTIONTYPE_EQUIP = 2;
public int getSize() { return size; }
public boolean isEquippable() { return actionType == ACTIONTYPE_EQUIP; }
public boolean isUsable() { return actionType == ACTIONTYPE_USE; }
public boolean isWeapon() { return inventorySlot == Inventory.WEARSLOT_WEAPON; }
public boolean isShield() { return inventorySlot == Inventory.WEARSLOT_SHIELD; }
public boolean isArmor() { return Inventory.isArmorSlot(inventorySlot); }
public boolean isTwohandWeapon() {
/*if (!isWeapon()) return false;
if (!isWeapon()) return false;
else if (size == SIZE_LARGE) return true;
else*/ return false;
else return false;
}
public boolean isOffhandCapableWeapon() {
/*if (!isWeapon()) return false;
if (!isWeapon()) return false;
else if (size == SIZE_LIGHT) return true;
else if (size == SIZE_STD) return true;
else*/ return false;
else return false;
}
}

View File

@@ -119,6 +119,22 @@ public final class SkillListAdapter extends ArrayAdapter<SkillInfo> {
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;
case SkillCollection.SKILL_WEAPON_PROFICIENCY_DAGGER: return R.string.skill_shortdescription_weapon_prof_dagger;
case SkillCollection.SKILL_WEAPON_PROFICIENCY_1HSWORD: return R.string.skill_shortdescription_weapon_prof_1hsword;
case SkillCollection.SKILL_WEAPON_PROFICIENCY_2HSWORD: return R.string.skill_shortdescription_weapon_prof_2hsword;
case SkillCollection.SKILL_WEAPON_PROFICIENCY_AXE: return R.string.skill_shortdescription_weapon_prof_axe;
case SkillCollection.SKILL_WEAPON_PROFICIENCY_BLUNT: return R.string.skill_shortdescription_weapon_prof_blunt;
case SkillCollection.SKILL_WEAPON_PROFICIENCY_UNARMED: return R.string.skill_shortdescription_weapon_prof_unarmed;
case SkillCollection.SKILL_ARMOR_PROFICIENCY_SHIELD: return R.string.skill_shortdescription_armor_prof_shield;
case SkillCollection.SKILL_ARMOR_PROFICIENCY_UNARMORED: return R.string.skill_shortdescription_armor_prof_unarmored;
case SkillCollection.SKILL_ARMOR_PROFICIENCY_LIGHT: return R.string.skill_shortdescription_armor_prof_light;
case SkillCollection.SKILL_ARMOR_PROFICIENCY_HEAVY: return R.string.skill_shortdescription_armor_prof_heavy;
case SkillCollection.SKILL_FIGHTSTYLE_DUAL_WIELD: return R.string.skill_shortdescription_fightstyle_dualwield;
case SkillCollection.SKILL_FIGHTSTYLE_2HAND: return R.string.skill_shortdescription_fightstyle_2hand;
case SkillCollection.SKILL_FIGHTSTYLE_WEAPON_SHIELD: return R.string.skill_shortdescription_fightstyle_weapon_shield;
case SkillCollection.SKILL_SPECIALIZATION_DUAL_WIELD: return R.string.skill_shortdescription_specialization_dualwield;
case SkillCollection.SKILL_SPECIALIZATION_2HAND: return R.string.skill_shortdescription_specialization_2hand;
case SkillCollection.SKILL_SPECIALIZATION_WEAPON_SHIELD: return R.string.skill_shortdescription_specialization_weapon_shield;
default:
return -1;
}