(PlayerCharacter pc, Equipment eq, int range, int content, int ammo, int hitMode, int attackNum)
| 1519 | } |
| 1520 | |
| 1521 | private static String getToHit(PlayerCharacter pc, Equipment eq, int range, int content, int ammo, int hitMode, |
| 1522 | int attackNum) |
| 1523 | { |
| 1524 | boolean isDouble = (eq.isDouble() && (eq.getLocation() == EquipmentLocation.EQUIPPED_TWO_HANDS)); |
| 1525 | boolean isDoubleSplit = (eq.isType("Head1") || eq.isType("Head2")); |
| 1526 | |
| 1527 | // If it's a two handed weapon, but is not |
| 1528 | // wielded as two handed, just punt now! |
| 1529 | if (eq.isMelee() && (eq.isWeaponTwoHanded(pc))) |
| 1530 | { |
| 1531 | if ((!isDouble && !isDoubleSplit && (hitMode != HITMODE_THHIT)) || (isDoubleSplit |
| 1532 | && (hitMode == HITMODE_BASEHIT || hitMode == HITMODE_OHHIT || hitMode == HITMODE_TWPHITH))) |
| 1533 | { |
| 1534 | return LanguageBundle.getString("SettingsHandler.not.applicable"); |
| 1535 | } |
| 1536 | } |
| 1537 | |
| 1538 | if (eq.isMelee() && eq.isWeaponOutsizedForPC(pc) && !eq.isNatural()) |
| 1539 | { |
| 1540 | return LanguageBundle.getString("SettingsHandler.not.applicable"); |
| 1541 | } |
| 1542 | |
| 1543 | int weaponBaseBonus = (int) eq.bonusTo(pc, "WEAPON", "WEAPONBAB", true); |
| 1544 | CDOMSingleRef<WeaponProf> ref = eq.get(ObjectKey.WEAPON_PROF); |
| 1545 | WeaponProf prof; |
| 1546 | String profKey; |
| 1547 | if (ref == null) |
| 1548 | { |
| 1549 | profKey = ""; |
| 1550 | prof = null; |
| 1551 | } |
| 1552 | else |
| 1553 | { |
| 1554 | prof = ref.get(); |
| 1555 | profKey = prof.getKeyName(); |
| 1556 | } |
| 1557 | |
| 1558 | weaponBaseBonus += (int) pc.getTotalBonusTo("WEAPONPROF=" + profKey, "WEAPONBAB"); |
| 1559 | weaponBaseBonus += getWeaponProfTypeBonuses(pc, eq, "WEAPONBAB", WPTYPEBONUS_PC); |
| 1560 | |
| 1561 | // The Melee, Ranged and Unarmed attack sequence |
| 1562 | String melee = getMeleeAttackString(pc, 0, weaponBaseBonus); |
| 1563 | String ranged = getRangedAttackString(pc, 0, weaponBaseBonus); |
| 1564 | String unarmed = getUnarmedAttackString(pc, 0, weaponBaseBonus); |
| 1565 | |
| 1566 | // Must leave this for 3.0 compatibility |
| 1567 | // 3.0 Monk uses special attack progression |
| 1568 | if (eq.isMonk()) |
| 1569 | { |
| 1570 | if (unarmed.length() > melee.length()) |
| 1571 | { |
| 1572 | melee = unarmed; |
| 1573 | } |
| 1574 | else if ((unarmed.length() == melee.length()) && !melee.equals(unarmed)) |
| 1575 | { |
| 1576 | StringTokenizer mTok = new StringTokenizer(melee, "+/", false); |
| 1577 | StringTokenizer m1Tok = new StringTokenizer(melee, "+/", false); |
| 1578 | String msString = mTok.nextToken(); |
no test coverage detected