MCPcopy Index your code
hub / github.com/PCGen/pcgen / DamageReduction

Class DamageReduction

code/src/java/pcgen/cdom/content/DamageReduction.java:41–180  ·  view source on GitHub ↗

Encapsulates a single DamageReduction entity. This class encapsulates a DamageReduction entity and provides utility methods to manipulate and combine multiple DamageReductions together. The consensus seems to be that brevity over clarity is preferred in the output so that is what the methods attempt

Source from the content-addressed store, hash-verified

39 *
40 */
41public class DamageReduction extends ConcretePrereqObject implements QualifyingObject
42{
43 private final Formula theReduction;
44 private final String theBypass;
45
46 /**
47 * Constructs a DamageReduction object. The reduction is stored as a string
48 * to allow use of JEP formulas and variables.
49 *
50 * @param aReduction
51 * The reduction to set
52 * @param aBypass
53 * The bypass type to set.
54 */
55 public DamageReduction(final Formula aReduction, final String aBypass)
56 {
57 theReduction = aReduction;
58 theBypass = aBypass;
59 }
60
61 /**
62 * Gets the string of damage types that bypass this DR.
63 *
64 * @return Returns the bypass.
65 */
66 public String getBypass()
67 {
68 return theBypass;
69 }
70
71 /**
72 * Gets the String representation of the amount of damage this DR reduces.
73 *
74 * @return Returns the amount of reduction.
75 */
76 public Formula getReduction()
77 {
78 return theReduction;
79 }
80
81 /**
82 * Gets the actual reduction this DR will apply. If the reduction is
83 * variable and requires the PC to process, this will return -1
84 *
85 * @return Amount of damage this DR reduces
86 */
87 public int getRawReductionValue()
88 {
89 return theReduction.isStatic() ? theReduction.resolveStatic().intValue() : -1;
90 }
91
92 /**
93 * Gets a list of Damage Types that bypass this DR. This is just a raw list
94 * of types.
95 *
96 * @return Collection of unique types converted to lower case
97 */
98 public Collection<String> getBypassList()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected