Module: Lich::DragonRealms::DRCS

Defined in:
documented/dragonrealms/commons/common-summoning.rb

Class Method Summary collapse

Class Method Details

.break_summoned_weapon(item) ⇒ void

Note:

This method does nothing if the item is nil.

This method returns an undefined value.

Breaks the summoned weapon if it exists.

Examples:

Breaking a summoned weapon

break_summoned_weapon("moonblade")

Parameters:

  • item (String, nil)

    The item to break.



69
70
71
72
73
# File 'documented/dragonrealms/commons/common-summoning.rb', line 69

def break_summoned_weapon(item)
  return if item.nil?

  DRC.bput("break my #{item}", 'Focusing your will', 'disrupting its matrix', "You can't break", "Break what")
end

.get_ingot(ingot, swap) ⇒ void

Note:

This method does nothing if the ingot is nil.

This method returns an undefined value.

Retrieves the specified ingot for use in summoning.

Examples:

Getting an ingot

get_ingot("iron", true)

Parameters:

  • ingot (String)

    The type of ingot to retrieve.

  • swap (Boolean)

    Indicates if the ingot should be swapped.



44
45
46
47
48
49
# File 'documented/dragonrealms/commons/common-summoning.rb', line 44

def get_ingot(ingot, swap)
  return unless ingot

  DRC.bput("get my #{ingot} ingot", 'You get')
  DRC.bput('swap', 'You move') if swap
end

.identify_summoned_weaponString?

Returns what kind of summoned weapon you’re holding. Will be the <adj> <noun> like ‘red-hot moonblade’ or ‘electric sword. Identifies the type of summoned weapon currently held.

Examples:

Identifying a summoned weapon

weapon = identify_summoned_weapon

Returns:

  • (String, nil)

    The description of the summoned weapon or nil if none.



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'documented/dragonrealms/commons/common-summoning.rb', line 110

def identify_summoned_weapon
  if DRStats.moon_mage?
    return DRC.right_hand if DRCMM.is_moon_weapon?(DRC.right_hand)
    return DRC.left_hand  if DRCMM.is_moon_weapon?(DRC.left_hand)
  elsif DRStats.warrior_mage?
    weapon_regex = /^You tap (?:a|an|some)(?:[\w\s\-]+)((stone|fiery|icy|electric) [\w\s\-]+) that you are holding.$/
    # For a two-worded weapon like 'short sword' the only way to know
    # which element it was summoned with is by tapping it. That's the only
    # way we can infer if it's a summoned sword or a regular one.
    # However, the <adj> <noun> of the item we return must be what's in
    # their hands, not what the regex matches in the tap.
    return DRC.right_hand if DRCI.tap(DRC.right_hand) =~ weapon_regex
    return DRC.left_hand if DRCI.tap(DRC.left_hand) =~ weapon_regex
  else
    echo "Unable to summon weapons as a #{DRStats.guild}"
  end
end

.pull_summoned_weaponvoid

This method returns an undefined value.

Pulls the summoned weapon back.

Examples:

Pulling a summoned weapon

pull_summoned_weapon

Raises:

  • (StandardError)

    If unable to pull the weapon.



163
164
165
166
167
168
169
170
171
# File 'documented/dragonrealms/commons/common-summoning.rb', line 163

def pull_summoned_weapon
  case DRC.bput("pull my #{GameObj.right_hand.noun}", 'You lack the elemental charge', 'Closing your eyes', 'That\'s as')
  when 'You lack the elemental charge'
    summon_admittance
    pull_summoned_weapon
  end
  pause 1
  waitrt?
end

.push_summoned_weaponvoid

This method returns an undefined value.

Pushes the summoned weapon forward.

Examples:

Pushing a summoned weapon

push_summoned_weapon

Raises:

  • (StandardError)

    If unable to push the weapon.



148
149
150
151
152
153
154
155
156
# File 'documented/dragonrealms/commons/common-summoning.rb', line 148

def push_summoned_weapon
  case DRC.bput("push my #{GameObj.right_hand.noun}", 'You lack the elemental charge', 'Closing your eyes', 'That\'s as')
  when 'You lack the elemental charge'
    summon_admittance
    push_summoned_weapon
  end
  pause 1
  waitrt?
end

.shape_summoned_weapon(skill, ingot = nil) ⇒ void

This method returns an undefined value.

Shapes the summoned weapon to a specified skill.

Examples:

Shaping a summoned weapon

shape_summoned_weapon("Staves", "iron")

Parameters:

  • skill (String)

    The skill to shape the weapon.

  • ingot (String, nil) (defaults to: nil)

    The type of ingot to use (optional).

Raises:

  • (StandardError)

    If unable to shape the weapon.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'documented/dragonrealms/commons/common-summoning.rb', line 82

def shape_summoned_weapon(skill, ingot = nil)
  if DRStats.moon_mage?
    skill_to_shape = { 'Staves' => 'blunt', 'Twohanded Edged' => 'huge', 'Large Edged' => 'heavy', 'Small Edged' => 'normal' }
    shape = skill_to_shape[skill]
    if DRCMM.hold_moon_weapon?
      DRC.bput("shape #{identify_summoned_weapon} to #{shape}", 'you adjust the magic that defines its shape', 'already has', 'You fumble around')
    end
  elsif DRStats.warrior_mage?
    get_ingot(ingot, false)
    case DRC.bput("shape my #{identify_summoned_weapon} to #{skill}", 'You lack the elemental charge', 'You reach out', 'You fumble around', "You don't know how to manipulate your weapon in that way")
    when 'You lack the elemental charge'
      summon_admittance
      shape_summoned_weapon(skill, nil)
    end
    stow_ingot(ingot)
  else
    echo "Unable to shape weapons as a #{DRStats.guild}"
  end
  pause 1
  waitrt?
end

.stow_ingot(ingot) ⇒ void

Note:

This method does nothing if the ingot is nil.

This method returns an undefined value.

Stows the specified ingot back into inventory.

Examples:

Stowing an ingot

stow_ingot("iron")

Parameters:

  • ingot (String)

    The type of ingot to stow.



57
58
59
60
61
# File 'documented/dragonrealms/commons/common-summoning.rb', line 57

def stow_ingot(ingot)
  return unless ingot

  DRC.bput("stow my #{ingot} ingot", 'You put')
end

.summon_admittancevoid

This method returns an undefined value.

Handles the admittance process for summoning.

Examples:

Summoning admittance

summon_admittance

Raises:

  • (StandardError)

    If unable to summon admittance.



178
179
180
181
182
183
184
185
186
187
# File 'documented/dragonrealms/commons/common-summoning.rb', line 178

def summon_admittance
  case DRC.bput('summon admittance', 'You align yourself to it', 'further increasing your proximity', 'Going any further while in this plane would be fatal', 'Summon allows Warrior Mages to draw', 'You are a bit too distracted')
  when 'You are a bit too distracted'
    DRC.retreat
    summon_admittance
  end
  pause 1
  waitrt?
  DRC.fix_standing
end

.summon_weapon(moon = nil, element = nil, ingot = nil, skill = nil) ⇒ void

This method returns an undefined value.

Summons a weapon based on the provided parameters.

Examples:

Summoning a weapon

summon_weapon("full", "fire", "iron", "sword")

Parameters:

  • moon (Object, nil) (defaults to: nil)

    The moon phase (optional).

  • element (String, nil) (defaults to: nil)

    The element of the weapon (optional).

  • ingot (String, nil) (defaults to: nil)

    The type of ingot to use (optional).

  • skill (String, nil) (defaults to: nil)

    The skill level for summoning (optional).

Raises:

  • (StandardError)

    If unable to summon a weapon.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'documented/dragonrealms/commons/common-summoning.rb', line 18

def summon_weapon(moon = nil, element = nil, ingot = nil, skill = nil)
  if DRStats.moon_mage?
    DRCMM.hold_moon_weapon?
  elsif DRStats.warrior_mage?
    get_ingot(ingot, true)
    case DRC.bput("summon weapon #{element} #{skill}", 'You lack the elemental charge', 'you draw out')
    when 'You lack the elemental charge'
      summon_admittance
      summon_weapon(moon, element, nil, skill)
    end
    stow_ingot(ingot)
  else
    echo "Unable to summon weapons as a #{DRStats.guild}"
  end
  pause 1
  waitrt?
  DRC.fix_standing
end

.turn_summoned_weaponvoid

This method returns an undefined value.

Turns the summoned weapon in the specified direction.

Examples:

Turning a summoned weapon

turn_summoned_weapon

Raises:

  • (StandardError)

    If unable to turn the weapon.



133
134
135
136
137
138
139
140
141
# File 'documented/dragonrealms/commons/common-summoning.rb', line 133

def turn_summoned_weapon
  case DRC.bput("turn my #{GameObj.right_hand.noun}", 'You lack the elemental charge', 'You reach out')
  when 'You lack the elemental charge'
    summon_admittance
    turn_summoned_weapon
  end
  pause 1
  waitrt?
end