Class: RPG::UsableItem

Inherits:
BaseItem show all
Defined in:
lib/rgss3/rpg.rb

Direct Known Subclasses

Item, Skill

Defined Under Namespace

Classes: Damage, Effect

Instance Attribute Summary collapse

Attributes inherited from BaseItem

#description, #features, #icon_index, #id, #name, #note

Instance Method Summary collapse

Constructor Details

#initializeUsableItem

Returns a new instance of UsableItem.



458
459
460
461
462
463
464
465
466
467
468
469
470
# File 'lib/rgss3/rpg.rb', line 458

def initialize
  super
  @scope = 0
  @occasion = 0
  @speed = 0
  @success_rate = 100
  @repeats = 1
  @tp_gain = 0
  @hit_type = 0
  @animation_id = 0
  @damage = RPG::UsableItem::Damage.new
  @effects = []
end

Instance Attribute Details

#animation_idObject

Returns the value of attribute animation_id.



516
517
518
# File 'lib/rgss3/rpg.rb', line 516

def animation_id
  @animation_id
end

#damageObject

Returns the value of attribute damage.



521
522
523
# File 'lib/rgss3/rpg.rb', line 521

def damage
  @damage
end

#effectsObject

Returns the value of attribute effects.



522
523
524
# File 'lib/rgss3/rpg.rb', line 522

def effects
  @effects
end

#hit_typeObject

Returns the value of attribute hit_type.



520
521
522
# File 'lib/rgss3/rpg.rb', line 520

def hit_type
  @hit_type
end

#occasionObject

Returns the value of attribute occasion.



514
515
516
# File 'lib/rgss3/rpg.rb', line 514

def occasion
  @occasion
end

#repeatsObject

Returns the value of attribute repeats.



518
519
520
# File 'lib/rgss3/rpg.rb', line 518

def repeats
  @repeats
end

#scopeObject

Returns the value of attribute scope.



513
514
515
# File 'lib/rgss3/rpg.rb', line 513

def scope
  @scope
end

#speedObject

Returns the value of attribute speed.



515
516
517
# File 'lib/rgss3/rpg.rb', line 515

def speed
  @speed
end

#success_rateObject

Returns the value of attribute success_rate.



517
518
519
# File 'lib/rgss3/rpg.rb', line 517

def success_rate
  @success_rate
end

#tp_gainObject

Returns the value of attribute tp_gain.



519
520
521
# File 'lib/rgss3/rpg.rb', line 519

def tp_gain
  @tp_gain
end

Instance Method Details

#battle_ok?Boolean

Returns:

  • (Boolean)


498
499
500
# File 'lib/rgss3/rpg.rb', line 498

def battle_ok?
  [0, 1].include?(@occasion)
end

#certain?Boolean

Returns:

  • (Boolean)


504
505
506
# File 'lib/rgss3/rpg.rb', line 504

def certain?
  @hit_type == 0
end

#for_all?Boolean

Returns:

  • (Boolean)


492
493
494
# File 'lib/rgss3/rpg.rb', line 492

def for_all?
  [2, 8, 10].include?(@scope)
end

#for_dead_friend?Boolean

Returns:

  • (Boolean)


477
478
479
# File 'lib/rgss3/rpg.rb', line 477

def for_dead_friend?
  [9, 10].include?(@scope)
end

#for_friend?Boolean

Returns:

  • (Boolean)


474
475
476
# File 'lib/rgss3/rpg.rb', line 474

def for_friend?
  [7, 8, 9, 10, 11].include?(@scope)
end

#for_one?Boolean

Returns:

  • (Boolean)


483
484
485
# File 'lib/rgss3/rpg.rb', line 483

def for_one?
  [1, 3, 7, 9, 11].include?(@scope)
end

#for_opponent?Boolean

Returns:

  • (Boolean)


471
472
473
# File 'lib/rgss3/rpg.rb', line 471

def for_opponent?
  [1, 2, 3, 4, 5, 6].include?(@scope)
end

#for_random?Boolean

Returns:

  • (Boolean)


486
487
488
# File 'lib/rgss3/rpg.rb', line 486

def for_random?
  [3, 4, 5, 6].include?(@scope)
end

#for_user?Boolean

Returns:

  • (Boolean)


480
481
482
# File 'lib/rgss3/rpg.rb', line 480

def for_user?
  @scope == 11
end

#magical?Boolean

Returns:

  • (Boolean)


510
511
512
# File 'lib/rgss3/rpg.rb', line 510

def magical?
  @hit_type == 2
end

Returns:

  • (Boolean)


501
502
503
# File 'lib/rgss3/rpg.rb', line 501

def menu_ok?
  [0, 2].include?(@occasion)
end

#need_selection?Boolean

Returns:

  • (Boolean)


495
496
497
# File 'lib/rgss3/rpg.rb', line 495

def need_selection?
  [1, 7, 9].include?(@scope)
end

#number_of_targetsObject



489
490
491
# File 'lib/rgss3/rpg.rb', line 489

def number_of_targets
  for_random? ? @scope - 2 : 0
end

#physical?Boolean

Returns:

  • (Boolean)


507
508
509
# File 'lib/rgss3/rpg.rb', line 507

def physical?
  @hit_type == 1
end