mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Added generic item icon support for HMs/TRs, moves taught by TR are now relearnable, tweaked determination of valid Mega forms
This commit is contained in:
@@ -1,60 +1,3 @@
|
|||||||
def bltMinimapAutotile(dstBitmap,x,y,srcBitmap,id)
|
|
||||||
return if id>=48 || !srcBitmap || srcBitmap.disposed?
|
|
||||||
anim=0
|
|
||||||
cxTile=3
|
|
||||||
cyTile=3
|
|
||||||
tiles = TileDrawingHelper::Autotiles[id>>3][id&7]
|
|
||||||
src=Rect.new(0,0,0,0)
|
|
||||||
for i in 0...4
|
|
||||||
tile_position = tiles[i] - 1
|
|
||||||
src.set(
|
|
||||||
tile_position % 6 * cxTile + anim,
|
|
||||||
tile_position / 6 * cyTile, cxTile, cyTile)
|
|
||||||
dstBitmap.blt(i%2*cxTile+x,i/2*cyTile+y, srcBitmap, src)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def passable?(passages,tile_id)
|
|
||||||
return false if tile_id == nil
|
|
||||||
passage = passages[tile_id]
|
|
||||||
return (passage && passage<15)
|
|
||||||
end
|
|
||||||
|
|
||||||
def getPassabilityMinimap(mapid)
|
|
||||||
map = load_data(sprintf("Data/Map%03d.rxdata",mapid))
|
|
||||||
tileset = $data_tilesets[map.tileset_id]
|
|
||||||
minimap = AnimatedBitmap.new("Graphics/Pictures/minimap_tiles")
|
|
||||||
ret = Bitmap.new(map.width*6,map.height*6)
|
|
||||||
passtable = Table.new(map.width,map.height)
|
|
||||||
passages = tileset.passages
|
|
||||||
for i in 0...map.width
|
|
||||||
for j in 0...map.height
|
|
||||||
pass=true
|
|
||||||
for z in [2,1,0]
|
|
||||||
if !passable?(passages,map.data[i,j,z])
|
|
||||||
pass=false
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
passtable[i,j]=pass ? 1 : 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
neighbors=TileDrawingHelper::NeighborsToTiles
|
|
||||||
for i in 0...map.width
|
|
||||||
for j in 0...map.height
|
|
||||||
if passtable[i,j]==0
|
|
||||||
nb=TileDrawingHelper.tableNeighbors(passtable,i,j)
|
|
||||||
tile=neighbors[nb]
|
|
||||||
bltMinimapAutotile(ret,i*6,j*6,minimap.bitmap,tile)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
minimap.disposes
|
|
||||||
return ret
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module ScreenPosHelper
|
module ScreenPosHelper
|
||||||
def self.pbScreenZoomX(ch)
|
def self.pbScreenZoomX(ch)
|
||||||
zoom=1.0
|
zoom=1.0
|
||||||
|
|||||||
@@ -200,3 +200,59 @@ def createMinimap(mapid)
|
|||||||
bitmap.fill_rect(bitmap.width-1,0,1,bitmap.height,black)
|
bitmap.fill_rect(bitmap.width-1,0,1,bitmap.height,black)
|
||||||
return bitmap
|
return bitmap
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def bltMinimapAutotile(dstBitmap,x,y,srcBitmap,id)
|
||||||
|
return if id>=48 || !srcBitmap || srcBitmap.disposed?
|
||||||
|
anim=0
|
||||||
|
cxTile=3
|
||||||
|
cyTile=3
|
||||||
|
tiles = TileDrawingHelper::Autotiles[id>>3][id&7]
|
||||||
|
src=Rect.new(0,0,0,0)
|
||||||
|
for i in 0...4
|
||||||
|
tile_position = tiles[i] - 1
|
||||||
|
src.set(
|
||||||
|
tile_position % 6 * cxTile + anim,
|
||||||
|
tile_position / 6 * cyTile, cxTile, cyTile)
|
||||||
|
dstBitmap.blt(i%2*cxTile+x,i/2*cyTile+y, srcBitmap, src)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def passable?(passages,tile_id)
|
||||||
|
return false if tile_id == nil
|
||||||
|
passage = passages[tile_id]
|
||||||
|
return (passage && passage<15)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Unused
|
||||||
|
def getPassabilityMinimap(mapid)
|
||||||
|
map = load_data(sprintf("Data/Map%03d.rxdata",mapid))
|
||||||
|
tileset = $data_tilesets[map.tileset_id]
|
||||||
|
minimap = AnimatedBitmap.new("Graphics/Pictures/minimap_tiles")
|
||||||
|
ret = Bitmap.new(map.width*6,map.height*6)
|
||||||
|
passtable = Table.new(map.width,map.height)
|
||||||
|
passages = tileset.passages
|
||||||
|
for i in 0...map.width
|
||||||
|
for j in 0...map.height
|
||||||
|
pass=true
|
||||||
|
for z in [2,1,0]
|
||||||
|
if !passable?(passages,map.data[i,j,z])
|
||||||
|
pass=false
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
passtable[i,j]=pass ? 1 : 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
neighbors=TileDrawingHelper::NeighborsToTiles
|
||||||
|
for i in 0...map.width
|
||||||
|
for j in 0...map.height
|
||||||
|
if passtable[i,j]==0
|
||||||
|
nb=TileDrawingHelper.tableNeighbors(passtable,i,j)
|
||||||
|
tile=neighbors[nb]
|
||||||
|
bltMinimapAutotile(ret,i*6,j*6,minimap.bitmap,tile)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
minimap.disposes
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|||||||
@@ -27,10 +27,20 @@ module GameData
|
|||||||
return ret if pbResolveBitmap(ret)
|
return ret if pbResolveBitmap(ret)
|
||||||
# Check for TM/HM type icons
|
# Check for TM/HM type icons
|
||||||
if item_data.is_machine?
|
if item_data.is_machine?
|
||||||
|
prefix = "machine"
|
||||||
|
if item.data_is_HM?
|
||||||
|
prefix = "machine_hm"
|
||||||
|
elsif item_data.is_TR?
|
||||||
|
prefix = "machine_tr"
|
||||||
|
end
|
||||||
move_type = GameData::Move.get(item_data.move).type
|
move_type = GameData::Move.get(item_data.move).type
|
||||||
type_data = GameData::Type.get(move_type)
|
type_data = GameData::Type.get(move_type)
|
||||||
ret = sprintf("Graphics/Items/machine_%s", type_data.id)
|
ret = sprintf("Graphics/Items/%s_%s", prefix, type_data.id)
|
||||||
return ret if pbResolveBitmap(ret)
|
return ret if pbResolveBitmap(ret)
|
||||||
|
if !item_data.is_TM?
|
||||||
|
ret = sprintf("Graphics/Items/machine_%s", type_data.id)
|
||||||
|
return ret if pbResolveBitmap(ret)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return "Graphics/Items/000"
|
return "Graphics/Items/000"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ end
|
|||||||
def pbUseItem(bag,item,bagscene=nil)
|
def pbUseItem(bag,item,bagscene=nil)
|
||||||
itm = GameData::Item.get(item)
|
itm = GameData::Item.get(item)
|
||||||
useType = itm.field_use
|
useType = itm.field_use
|
||||||
if itm.is_machine? # TM or HM
|
if itm.is_machine? # TM or TR or HM
|
||||||
if $Trainer.pokemon_count == 0
|
if $Trainer.pokemon_count == 0
|
||||||
pbMessage(_INTL("There is no Pokémon."))
|
pbMessage(_INTL("There is no Pokémon."))
|
||||||
return 0
|
return 0
|
||||||
@@ -461,7 +461,7 @@ def pbUseItem(bag,item,bagscene=nil)
|
|||||||
pbMessage(_INTL("\\se[PC access]You booted up {1}.\1",itm.name))
|
pbMessage(_INTL("\\se[PC access]You booted up {1}.\1",itm.name))
|
||||||
if !pbConfirmMessage(_INTL("Do you want to teach {1} to a Pokémon?",movename))
|
if !pbConfirmMessage(_INTL("Do you want to teach {1} to a Pokémon?",movename))
|
||||||
return 0
|
return 0
|
||||||
elsif pbMoveTutorChoose(machine,nil,true)
|
elsif pbMoveTutorChoose(machine,nil,true,itm.is_TR?)
|
||||||
bag.pbDeleteItem(item) if itm.is_TR?
|
bag.pbDeleteItem(item) if itm.is_TR?
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class Pokemon
|
|||||||
def getMegaForm(checkItemOnly = false)
|
def getMegaForm(checkItemOnly = false)
|
||||||
ret = 0
|
ret = 0
|
||||||
GameData::Species.each do |data|
|
GameData::Species.each do |data|
|
||||||
next if data.species != @species
|
next if data.species != @species || data.unmega_form != form_simple
|
||||||
if data.mega_stone && hasItem?(data.mega_stone)
|
if data.mega_stone && hasItem?(data.mega_stone)
|
||||||
ret = data.form
|
ret = data.form
|
||||||
break
|
break
|
||||||
@@ -31,7 +31,6 @@ class Pokemon
|
|||||||
megaForm = self.getMegaForm
|
megaForm = self.getMegaForm
|
||||||
return megaForm > 0 && megaForm == form_simple
|
return megaForm > 0 && megaForm == form_simple
|
||||||
end
|
end
|
||||||
alias isMega? mega?
|
|
||||||
|
|
||||||
def makeMega
|
def makeMega
|
||||||
megaForm = self.getMegaForm
|
megaForm = self.getMegaForm
|
||||||
@@ -57,24 +56,23 @@ class Pokemon
|
|||||||
# NOTE: These are treated as form changes in Essentials.
|
# NOTE: These are treated as form changes in Essentials.
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def hasPrimalForm?
|
def hasPrimalForm?
|
||||||
v = MultipleForms.call("getPrimalForm",self)
|
v = MultipleForms.call("getPrimalForm", self)
|
||||||
return v!=nil
|
return !v.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def primal?
|
def primal?
|
||||||
v = MultipleForms.call("getPrimalForm",self)
|
v = MultipleForms.call("getPrimalForm", self)
|
||||||
return v!=nil && v==@form
|
return !v.nil? && v == @form
|
||||||
end
|
end
|
||||||
alias isPrimal? primal?
|
|
||||||
|
|
||||||
def makePrimal
|
def makePrimal
|
||||||
v = MultipleForms.call("getPrimalForm",self)
|
v = MultipleForms.call("getPrimalForm", self)
|
||||||
self.form = v if v!=nil
|
self.form = v if !v.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def makeUnprimal
|
def makeUnprimal
|
||||||
v = MultipleForms.call("getUnprimalForm",self)
|
v = MultipleForms.call("getUnprimalForm", self)
|
||||||
if v!=nil; self.form = v
|
if !v.nil?; self.form = v
|
||||||
elsif primal?; self.form = 0
|
elsif primal?; self.form = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -193,6 +193,8 @@ class Pokemon
|
|||||||
deprecated_method_alias :pbUpdateShadowMoves, :update_shadow_moves, removal_in: 'v20'
|
deprecated_method_alias :pbUpdateShadowMoves, :update_shadow_moves, removal_in: 'v20'
|
||||||
deprecated_method_alias :isForeign?, :foreign?, removal_in: 'v20'
|
deprecated_method_alias :isForeign?, :foreign?, removal_in: 'v20'
|
||||||
deprecated_method_alias :calcStats, :calc_stats, removal_in: 'v20'
|
deprecated_method_alias :calcStats, :calc_stats, removal_in: 'v20'
|
||||||
|
deprecated_method_alias :isMega?, :mega?, removal_in: 'v20'
|
||||||
|
deprecated_method_alias :isPrimal?, :primal?, removal_in: 'v20'
|
||||||
end
|
end
|
||||||
|
|
||||||
# (see Pokemon#initialize)
|
# (see Pokemon#initialize)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class Window_PokemonItemStorage < Window_DrawableCommand
|
|||||||
itemname = @adapter.getDisplayName(item)
|
itemname = @adapter.getDisplayName(item)
|
||||||
baseColor = (index==@sortIndex) ? Color.new(248,24,24) : self.baseColor
|
baseColor = (index==@sortIndex) ? Color.new(248,24,24) : self.baseColor
|
||||||
textpos.push([itemname,rect.x,rect.y-6,false,self.baseColor,self.shadowColor])
|
textpos.push([itemname,rect.x,rect.y-6,false,self.baseColor,self.shadowColor])
|
||||||
if !GameData::Item.get(item).is_important? # Not a Key item or HM (or infinite TM)
|
if !GameData::Item.get(item).is_important? # Not a Key item/HM/TM
|
||||||
qty = _ISPRINTF("x{1: 2d}",@bag[index][1])
|
qty = _ISPRINTF("x{1: 2d}",@bag[index][1])
|
||||||
sizeQty = self.contents.text_size(qty).width
|
sizeQty = self.contents.text_size(qty).width
|
||||||
xQty = rect.x+rect.width-sizeQty-2
|
xQty = rect.x+rect.width-sizeQty-2
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ def pbMoveTutorAnnotations(move, movelist = nil)
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbMoveTutorChoose(move,movelist=nil,bymachine=false)
|
def pbMoveTutorChoose(move,movelist=nil,bymachine=false,oneusemachine=false)
|
||||||
ret = false
|
ret = false
|
||||||
move = GameData::Move.get(move).id
|
move = GameData::Move.get(move).id
|
||||||
if movelist!=nil && movelist.is_a?(Array)
|
if movelist!=nil && movelist.is_a?(Array)
|
||||||
@@ -454,6 +454,7 @@ def pbMoveTutorChoose(move,movelist=nil,bymachine=false)
|
|||||||
pbMessage(_INTL("{1} can't learn {2}.",pokemon.name,movename)) { screen.pbUpdate }
|
pbMessage(_INTL("{1} can't learn {2}.",pokemon.name,movename)) { screen.pbUpdate }
|
||||||
else
|
else
|
||||||
if pbLearnMove(pokemon,move,false,bymachine) { screen.pbUpdate }
|
if pbLearnMove(pokemon,move,false,bymachine) { screen.pbUpdate }
|
||||||
|
pkmn.add_first_move(move) if oneusemachine
|
||||||
ret = true
|
ret = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user