pfrpg_core 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46b77135cb44d70be9a7a8016e3a16332b9e32e8
4
- data.tar.gz: 1bd21a26bdd7b4f585ac9b7b1179f577f4dbef5b
3
+ metadata.gz: 7230bb7e6b619c3e3b3538803d8ee82702a0fdb6
4
+ data.tar.gz: cf8269824b88b85f76adaa8c92f787417ad42df4
5
5
  SHA512:
6
- metadata.gz: 4a89d1996ccfab038905f889af7c36a9d22dadc5b5034740f6eeb056916a72bd8c6411ffd487475b6ce545c3861725556c3bdd3ee3562e36774aac80108ece26
7
- data.tar.gz: a7128e64b9ad51529775096d1d20972af547cd1e98870c0baafc4978e112656ad066fad618a6a10b3b6207e035deb1f425b2294c142b670fb1a873cb6ae248b5
6
+ metadata.gz: 69d5f7dabe6d63e9cd06a2215da2055b4dbd137d253c42595413a5ae4c557b0a03517615bcce737aa7457ad13ff7168197d13352f17f2df7b5f99f5a4f819521
7
+ data.tar.gz: dafa421d558055c87dd5bb463382150ab97b78289d5fdcc360062f7274794cc2cd1bcc688b2ad0cf644e8f2b24c0ea2ccee3454821ac51bf62262b1631a1ad62
@@ -5,7 +5,7 @@ module PfrpgCore
5
5
  attr_accessor :weapon_name, :range, :damage, :weapon_type,
6
6
  :base_bonus, :weapon_bonus, :weight_class, :critical_range,
7
7
  :critical_dmg, :size, :weapon, :other_bonus, :filter_str,
8
- :strength_bonus, :bab, :macros
8
+ :strength_bonus, :bab, :macros, :masterwork
9
9
 
10
10
  def initialize(args)
11
11
  @weapon_name = args[:weapon_name]
@@ -23,6 +23,7 @@ module PfrpgCore
23
23
  @filter_str = []
24
24
  @weapon = args[:weapon]
25
25
  @macros = args[:macros]
26
+ @masterwork = args[:masterwork]
26
27
  @other_bonus = 0 # things like weapon spec, training, etc
27
28
  apply_filters
28
29
  end
@@ -15,7 +15,8 @@ module PfrpgCore
15
15
  PfrpgCore::Filters::RangedAttackMod.new(character),
16
16
  PfrpgCore::Filters::WeaponFocusMod.new(character),
17
17
  PfrpgCore::Filters::WeaponSpecializationMod.new(character),
18
- PfrpgCore::Filters::ProficiencyMod.new(character)
18
+ PfrpgCore::Filters::ProficiencyMod.new(character),
19
+ PfrpgCore::Filters::MasterworkMod.new(character)
19
20
  ]
20
21
  standard_filters << character.get_attack_filters
21
22
  standard_filters.flatten
@@ -26,6 +27,7 @@ module PfrpgCore
26
27
 
27
28
  atk = character.inventory.equipped_weapons(character.levels).collect do |w|
28
29
  Attack.new({ :weapon_name => w.get_best_name,
30
+ :masterwork => w.masterwork,
29
31
  :range => w.range,
30
32
  :weight_class => w.weight_class,
31
33
  :damage => w.damage,
@@ -0,0 +1,21 @@
1
+ module PfrpgCore
2
+ module Filters
3
+ class MasterworkMod
4
+ attr_reader :character
5
+ def initialize(character)
6
+ @character = character
7
+ end
8
+
9
+ def filter(attack)
10
+ if (attack.weapon_bonus == nil || attack.weapon_bonus == 0)
11
+ modify_attack_for_masterwork(attack) if attack.masterwork
12
+ end
13
+ end
14
+
15
+ def modify_attack_for_masterwork (attack)
16
+ attack.filter_str << "Masterwork: +1 to hit"
17
+ attack.other_bonus += 1
18
+ end
19
+ end
20
+ end
21
+ end
@@ -45,7 +45,11 @@ module PfrpgCore
45
45
  def ac_penalty(bonuses = Bonuses.new)
46
46
  ac_penalty = 0
47
47
  equipment.each do |e|
48
- ac_penalty += NullObject.maybe(e.armor_check_penalty).to_i
48
+ base = NullObject.maybe(e.armor_check_penalty).to_i
49
+ if (e.masterwork && base < 0 && (e.bonus == nil || e.bonus == 0))
50
+ base += 1
51
+ end
52
+ ac_penalty += base
49
53
  end
50
54
  ac_penalty += bonuses.get("ac_penalty").to_i
51
55
  ac_penalty = 0 if ac_penalty > 0
@@ -78,7 +78,7 @@ module PfrpgCore
78
78
  if skill[:skill].ac_penalty?
79
79
  ac_penalty = character.get_ac_penalty
80
80
  end
81
- ac_penalty
81
+ return (-1 * ac_penalty)
82
82
  end
83
83
 
84
84
  def calculate_attribute_bonus(skill, character)
@@ -1,3 +1,3 @@
1
1
  module PfrpgCore
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pfrpg_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan OMara
@@ -45,6 +45,7 @@ files:
45
45
  - lib/pfrpg_core/feature_totaler.rb
46
46
  - lib/pfrpg_core/filterable.rb
47
47
  - lib/pfrpg_core/filters/filter.rb
48
+ - lib/pfrpg_core/filters/masterwork_mod.rb
48
49
  - lib/pfrpg_core/filters/proficiency_mod.rb
49
50
  - lib/pfrpg_core/filters/prowess_mod.rb
50
51
  - lib/pfrpg_core/filters/ranged_attack_mod.rb