Minor new additions for v20 (#147)

* Moved TMs/ TRs and HMs into their own handlers
* Improved Plugin Error Message
* Added sound effect when picking berries
* Allow player to always see quantity when buying items
* Trainers now require a Mega Ring item in their items (in trainers.txt) to Mega Evolve
This commit is contained in:
Golisopod-User
2021-12-30 00:06:26 +05:30
committed by GitHub
parent fb29f19a28
commit 13cc9790ce
11 changed files with 81 additions and 46 deletions

View File

@@ -54,6 +54,7 @@ class Battle
attr_reader :player # Player trainer (or array of trainers)
attr_reader :opponent # Opponent trainer (or array of trainers)
attr_accessor :items # Items held by opponents
attr_accessor :ally_items # Items held by allies
attr_accessor :endSpeeches
attr_accessor :endSpeechesWin
attr_accessor :party1starts # Array of start indexes for each player-side trainer's party
@@ -119,6 +120,7 @@ class Battle
@player = player # Array of Player/NPCTrainer objects, or nil
@opponent = opponent # Array of NPCTrainer objects, or nil
@items = nil
@ally_items = nil # Array of items held by ally. This is just used for Mega Evolution for now.
@endSpeeches = []
@endSpeechesWin = []
@party1 = p1
@@ -167,6 +169,8 @@ class Battle
else
@struggle = Move::Struggle.new(self, nil)
end
@mega_rings = []
GameData::Item.each { |item| @mega_rings.push(item.id) if item.has_flag?("MegaRing") }
end
#=============================================================================
@@ -259,8 +263,14 @@ class Battle
end
def pbGetOwnerItems(idxBattler)
return [] if !@items || !opposes?(idxBattler)
return @items[pbGetOwnerIndexFromBattlerIndex(idxBattler)]
if opposes?(idxBattler)
return [] if !@items
return @items[pbGetOwnerIndexFromBattlerIndex(idxBattler)]
else
return [] if !@ally_items
return @ally_items[pbGetOwnerIndexFromBattlerIndex(idxBattler)]
end
return []
end
# Returns whether the battler in position idxBattler is owned by the same