Class: Battle::Logic::WeatherChangeHandler

Inherits:
ChangeHandlerBase show all
Defined in:
docs/5_Battle_04_Logic.rb

Overview

Handler responsive of answering properly weather changes requests

Constant Summary collapse

WEATHER_SYM_TO_MSG =

Mapping between weather symbol & message_id

{none: {sunny: 92, rain: 93, sandstorm: 94, hail: 95, fog: 96, snow: 288, hardsun: 272, hardrain: 270, strong_winds: 274}, rain: 88, sunny: 87, sandstorm: 89, hail: 90, fog: 91, hardsun: 271, hardrain: 269, strong_winds: 273, snow: 287}

Instance Attribute Summary

Attributes inherited from ChangeHandlerBase

#logic, #pre_checked_effects, #scene

Instance Method Summary collapse

Methods inherited from ChangeHandlerBase

#pass_change, #prevent_change, #process_reason, #reset_reason

Constructor Details

#initialize(logic, scene, env = $env) ⇒ WeatherChangeHandler

Create a new Weather Change Handler

Parameters:



1287
1288
# File 'docs/5_Battle_04_Logic.rb', line 1287

def initialize(logic, scene, env = $env)
end

Instance Method Details

#current_weather?(weather_type) ⇒ Boolean

Check if the given weather type is already the current weather

Parameters:

  • weather_type (Symbol) —

    :none, :rain, :sunny, :sandstorm, :hail, :fog, :hardsun, :hardrain

Returns:

  • (Boolean)


1292
1293
# File 'docs/5_Battle_04_Logic.rb', line 1292

def current_weather?(weather_type)
end

#weather_appliable?(weather_type) ⇒ Boolean

Function telling if a weather can be applyied

Parameters:

  • weather_type (Symbol) —

    :none, :rain, :sunny, :sandstorm, :hail, :fog, :hardsun, :hardrain

Returns:

  • (Boolean)


1297
1298
# File 'docs/5_Battle_04_Logic.rb', line 1297

def weather_appliable?(weather_type)
end

#weather_change(weather_type, nb_turn = nil)

Function that actually change the weather

Parameters:

  • weather_type (Symbol) —

    :none, :rain, :sunny, :sandstorm, :hail, :fog, :hardsun, :hardrain

  • nb_turn (Integer, nil) (defaults to: nil) —

    Number of turn, use nil for Infinity



1302
1303
# File 'docs/5_Battle_04_Logic.rb', line 1302

def weather_change(weather_type, nb_turn = nil)
end

#weather_change_with_process(weather_type, nb_turn = nil)

Function that test if the change is possible and perform the change if so

Parameters:

  • weather_type (Symbol) —

    :none, :rain, :sunny, :sandstorm, :hail, :fog, :hardsun, :hardrain

  • nb_turn (Integer, nil) (defaults to: nil) —

    Number of turn, use nil for Infinity



1307
1308
# File 'docs/5_Battle_04_Logic.rb', line 1307

def weather_change_with_process(weather_type, nb_turn = nil)
end