Advertisement
roninator2

Galv Magic Shard - Combine three

Nov 3rd, 2020 (edited)
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.54 KB | Source Code | 0 0
  1. # ╔═════════════════════════════════════╦════════════════════╗
  2. # ║ Title: Magic Shard addon            ║  Version: 1.00     ║
  3. # ║ Author: Roninator2                  ║                    ║
  4. # ╠═════════════════════════════════════╬════════════════════╣
  5. # ║ Function:                           ║   Date Created     ║
  6. # ║ Galv's Magic Shards -               ╠════════════════════╣
  7. # ║ Allows combinations of 3 shards     ║    01 Nov 2020     ║
  8. # ╚═════════════════════════════════════╩════════════════════╝
  9. # ╔══════════════════════════════════════════════════════════╗
  10. # ║ These are setup in Galvs script NOT HERE!                ║
  11. # ║                                                          ║
  12. # ║ [shard_id,shard_id,shard_id] => skill_id,                ║
  13. # ║ [1,2,3] => 46, # fire and water and earth = skill 46     ║
  14. # ╚══════════════════════════════════════════════════════════╝
  15. # ╔═════════════════════════════════════╗
  16. # ║ Terms of use:                       ║
  17. # ║ Follow the Original Authors terms   ║
  18. # ╚═════════════════════════════════════╝
  19.  
  20. class Game_Actor < Game_Battler
  21.   def shard_linked_skills_three
  22.     lst = Galv_Shard::SHARDS
  23.     return [] if !shards
  24.     sarray = []
  25.     shards.each_with_index { |s,i|
  26.       nxt = shards[i + 1].nil? ? 0 : i + 1
  27.       fst = shards[i - 1].nil? ? 0 : i - 1
  28.       next if s == :blank || shards[nxt] == :blank || shards[fst] == :blank
  29.       check_three = [shards[i].shard,shards[nxt].shard,shards[fst].shard].sort
  30.       sarray << lst[check_three] if lst.keys.include?(check_three)
  31.     }
  32.     sarray.compact
  33.   end
  34.   alias r2_galv_shards_ga_added_skills added_skills
  35.   def added_skills
  36.     r2_galv_shards_ga_added_skills + shard_linked_skills_three
  37.   end
  38.   def add_shard_actor(actor,amount)
  39.     if actor == 0
  40.       $game_party.leader.add_shard_level(amount)
  41.     elsif actor > 0
  42.       return if $game_actors[actor].nil?
  43.       $game_actors[actor].add_shard_level(amount)
  44.     end
  45.   end
  46. end
  47.  
  48. class Scene_Shards < Scene_MenuBase
  49.  
  50.   def do_shard_change
  51.     learned = @actor.shard_linked_skills - @actor.known_links && @actor.shard_linked_skills_three - @actor.known_links
  52.     forgot = @actor.known_links - @actor.shard_linked_skills && @actor.known_links - @actor.shard_linked_skills_three
  53.     learn_usable = []
  54.     forgot_usable = []
  55.     learned.each { |sid|
  56.       if @actor.added_skill_types.include?($data_skills[sid].stype_id)
  57.         learn_usable << sid
  58.       end
  59.     }
  60.     forgot.each { |sid|
  61.       if @actor.added_skill_types.include?($data_skills[sid].stype_id)
  62.         forgot_usable << sid
  63.       end
  64.     }
  65.  
  66.     @info_window.display(learn_usable,forgot_usable)
  67.     @actor.known_links = @actor.shard_linked_skills && @actor.shard_linked_skills_three
  68.   end
  69.  
  70. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement