amar-rpg 2.1.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/amar-tui.rb +1 -1
  3. data/includes/class_npc_new.rb +45 -47
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58d7a7e1e8688949f6e0beed811aeab31928d09cd6a2c7b602aba9706b617b5d
4
- data.tar.gz: 776ed77dce45af1ab2d8eb412beebf733e7ba509738c8b7328fe048e32227913
3
+ metadata.gz: 2bdc61cf6d9ff6b07fc95dfc822d63a5bca306892ce47e6f9dd6dd81333d0f7e
4
+ data.tar.gz: 7727d43ea06e90644243c5285c5377606e858ce720692d47412d2a6a61061aaf
5
5
  SHA512:
6
- metadata.gz: bc917d0a80ff2b84a2aa2a87196609fc880aeca6f9f267b60492e523c41860bc529af1d73885942c7030c4fed07eb7869dcce7c4a4fd6cf76764babdbd05c1de
7
- data.tar.gz: c5e7639280c0aa684396b6b669ff0a5d5d0301b16b6c0408f3a3bb2b7409fbb2d0e7eebe0471679cb643d7c3f404bacf78610e854a67ed374356d7bb444e400b
6
+ metadata.gz: 244dc76fd72a90221b996a45c4d34b2c277974578c3adf2decff59c12bb80d75d1673fd10d41a30868debb0ba51795682310a8a738406ed796e8385196cc7a60
7
+ data.tar.gz: fad7b596d3c51a13c850adea69c5f497cd55e46768bb4955b84cac7f2a95277b5411349878cae45a0e29464574ae075a8fd003c7a33e7a89264356005ffa70a8
data/amar-tui.rb CHANGED
@@ -60,7 +60,7 @@ require 'stringio' # For suppressing output
60
60
  require 'fcntl' # For non-blocking IO
61
61
 
62
62
  # GLOBAL VARS & CONSTANTS
63
- @version = "2.1.1"
63
+ @version = "2.1.2"
64
64
  $pgmdir = File.dirname(__FILE__) # Global for includes
65
65
 
66
66
  # Debug logging
@@ -460,9 +460,9 @@ class NpcNew
460
460
  level
461
461
  end
462
462
 
463
- def select_actual_weapon(skill_name, strength_total, is_missile = false)
464
- # Map skill name to actual weapon from $Melee or $Missile table
465
- # Load weapon tables if needed
463
+ def select_actual_weapon_from_table(skill_name, strength_char, is_missile = false)
464
+ # Select actual weapon from $Melee or $Missile table based on skill and strength
465
+ # This mimics the original weapon selection system
466
466
  unless defined?($Melee)
467
467
  load File.join($pgmdir, "includes/tables/melee.rb")
468
468
  end
@@ -471,75 +471,72 @@ class NpcNew
471
471
  end
472
472
 
473
473
  if is_missile
474
- # Map missile skill names to actual weapons
474
+ # Select from $Missile table based on skill type
475
475
  case skill_name.downcase
476
476
  when /bow/
477
477
  # Select bow based on strength: L(2), M(4), H(6), H2(8), H3(10)
478
- if strength_total >= 10
478
+ if strength_char >= 10
479
479
  "Bow(H3) [1]"
480
- elsif strength_total >= 8
480
+ elsif strength_char >= 8
481
481
  "Bow(H2) [1]"
482
- elsif strength_total >= 6
482
+ elsif strength_char >= 6
483
483
  "Bow(H) [1]"
484
- elsif strength_total >= 4
484
+ elsif strength_char >= 4
485
485
  "Bow(M) [1]"
486
486
  else
487
487
  "Bow(L) [1]"
488
488
  end
489
489
  when /crossbow|x-bow/
490
- # Select crossbow based on strength
491
- if strength_total >= 4
490
+ if strength_char >= 4
492
491
  "X-bow(H) [¼]"
493
- elsif strength_total >= 3
492
+ elsif strength_char >= 3
494
493
  "X-bow(M) [⅓]"
495
494
  else
496
495
  "X-bow(L) [½]"
497
496
  end
498
- when /throwing|knife/
497
+ when /throwing/
499
498
  "Th Knife [2]"
500
499
  when /javelin/
501
500
  "Javelin [1]"
502
501
  when /sling/
503
502
  "Sling [1]"
504
503
  when /net/
505
- skill_name # Net is just "Net"
504
+ "Net"
506
505
  when /spear/
507
- "Javelin [1]" # Thrown spear = javelin
506
+ "Javelin [1]"
508
507
  else
509
- "Rock [2]" # Default
508
+ "Rock [2]"
510
509
  end
511
510
  else
512
- # Map melee skill names to actual weapons from $Melee table
513
- case skill_name.downcase
514
- when /sword/
515
- strength_total >= 4 ? "Longsword" : "Short sword"
516
- when /axe/
517
- strength_total >= 4 ? "B. axe 2H" : "Hatchet"
518
- when /spear/
519
- strength_total >= 4 ? "Spear 2H" : "Spear"
520
- when /mace/
521
- strength_total >= 4 ? "H. mace 2H" : "Light mace"
522
- when /dagger|knife/
523
- "Knife"
524
- when /staff/
525
- "Staff"
526
- when /club/
527
- "Club"
528
- when /net/
529
- "Net"
530
- when /shield/
531
- "Buckler"
532
- when /unarmed/
533
- "Unarmed"
511
+ # Select from $Melee table based on Wield Weapon total (replaces old STRENGTH)
512
+ # This is BODY + Strength + Wield weapon skill
513
+ # Determine weapon level range based on Wield Weapon total
514
+ wpn_level = case strength_char
515
+ when 0..1 then 2
516
+ when 2..3 then 4
517
+ when 4..6 then 11
518
+ when 7..9 then 18
519
+ when 10..12 then 22
520
+ when 13..15 then 26
521
+ when 16..18 then 28
522
+ else 30
523
+ end
524
+
525
+ # Select random weapon from available range
526
+ weapon_idx = rand(wpn_level) + 1
527
+ weapon_data = $Melee[weapon_idx]
528
+
529
+ if weapon_data
530
+ weapon_data[0].strip # Return weapon name like "Longsword/Buc"
534
531
  else
535
- skill_name # Return as-is if no match
532
+ skill_name # Fallback to skill name
536
533
  end
537
534
  end
538
535
  end
539
536
 
540
537
  def add_weapon_skills(template)
541
538
  # Add melee weapon skills with primary weapon specialization
542
- # Also store actual weapon selections based on skill names
539
+ # Also store actual weapon selections from $Melee/$Missile tables
543
540
  if template["melee_weapons"]
544
541
  @tiers["BODY"]["Melee Combat"]["skills"] ||= {}
545
542
  @tiers["BODY"]["Melee Combat"]["actual_weapons"] ||= {}
@@ -547,8 +544,9 @@ class NpcNew
547
544
  # Find primary weapon (highest base value)
548
545
  primary_weapon = template["melee_weapons"].max_by { |_, v| v }
549
546
 
550
- # Get strength total for weapon selection
551
- strength_total = get_skill_total("BODY", "Strength", "Wield weapon") rescue 3
547
+ # Get Wield Weapon total for weapon table selection (replaces old STRENGTH)
548
+ # This is BODY + Strength + Wield weapon skill
549
+ wield_total = get_skill_total("BODY", "Strength", "Wield weapon") rescue 3
552
550
 
553
551
  template["melee_weapons"].each_with_index do |(weapon, skill_level), index|
554
552
  base_level = calculate_tier_level(skill_level, @level, 0.6)
@@ -561,8 +559,8 @@ class NpcNew
561
559
 
562
560
  @tiers["BODY"]["Melee Combat"]["skills"][weapon] = base_level
563
561
 
564
- # Select actual weapon based on skill name and strength
565
- actual_weapon = select_actual_weapon(weapon, strength_total, false)
562
+ # Select actual weapon from $Melee table based on Wield Weapon total
563
+ actual_weapon = select_actual_weapon_from_table(weapon, wield_total, false)
566
564
  @tiers["BODY"]["Melee Combat"]["actual_weapons"][weapon] = actual_weapon
567
565
  end
568
566
  end
@@ -575,8 +573,8 @@ class NpcNew
575
573
  # Find primary missile weapon
576
574
  primary_missile = template["missile_weapons"].max_by { |_, v| v }
577
575
 
578
- # Get strength total for missile weapon selection
579
- strength_total = get_skill_total("BODY", "Strength", "Wield weapon") rescue 3
576
+ # Get Wield Weapon total for missile weapon selection (bow strength requirements)
577
+ wield_total = get_skill_total("BODY", "Strength", "Wield weapon") rescue 3
580
578
 
581
579
  template["missile_weapons"].each do |weapon, skill_level|
582
580
  base_level = calculate_tier_level(skill_level, @level, 0.6)
@@ -589,8 +587,8 @@ class NpcNew
589
587
 
590
588
  @tiers["BODY"]["Missile Combat"]["skills"][weapon] = base_level
591
589
 
592
- # Select actual weapon based on skill name and strength
593
- actual_weapon = select_actual_weapon(weapon, strength_total, true)
590
+ # Select actual weapon based on Wield Weapon total
591
+ actual_weapon = select_actual_weapon_from_table(weapon, wield_total, true)
594
592
  @tiers["BODY"]["Missile Combat"]["actual_weapons"][weapon] = actual_weapon
595
593
  end
596
594
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amar-rpg
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
@@ -123,7 +123,7 @@ metadata:
123
123
  post_install_message: |2+
124
124
 
125
125
  ===========================================
126
- AMAR RPG Tools v2.1.1 has been installed!
126
+ AMAR RPG Tools v2.1.2 has been installed!
127
127
  ===========================================
128
128
 
129
129
  To start the application: