• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
Resource icon

v20.1 Functional Legend Plate 1.0

This resource pertains to version 20.1 of Pokémon Essentials.
Pokémon Essentials Version
v20.1 ➖
You waited for it for more than a year and there it is : a functional Legend Plate !

It's my first scripting project, and one I have for a long time, from the first time seeing the Arceus movie and how cool this Pokemon God is.

But enough backstory, here's a rapide summary of what the following code provides :
  • the PBS for the Legend Plate item
  • a script for Judgment to change type based on the weakness of the target, favoring X4 weakness and the less weaknesses against the STAB-moves of it
  • this script is a free adaptation of the concept : in PLA, there were no abilities nor items, so I made sure that no Electric-Type with Air Balloon or any pesky Primo-Groudon could evade the might of the God - feel free to change this if you think it's too broken (but anyway, it will still be broken)
  • no sprite provided for the Legend Plate, but you can find one in the excellent Generation 9 Resource Pack

And now, for the code, you need to add :

Code:
Expand Collapse Copy
#-------------------------------
[LEGENDPLATE]
Name = Legend Plate
NamePlural = Legend Plates
Pocket = 1
Price = 20000
SellPrice = 0
Flags = Fling_90
Description = A stone tablet to be held by a certain Pokémon. It the holder the power of every type there is.

Code:
Expand Collapse Copy
#===============================================================================
# Type depends on the user's held Plate. (Judgment)
#===============================================================================
class Battle::Move::TypeDependsOnUserPlate < Battle::Move
  def initialize(battle, move)
    super
    @itemTypes = {
      :FISTPLATE   => :FIGHTING,
      :SKYPLATE    => :FLYING,
      :TOXICPLATE  => :POISON,
      :EARTHPLATE  => :GROUND,
      :STONEPLATE  => :ROCK,
      :INSECTPLATE => :BUG,
      :SPOOKYPLATE => :GHOST,
      :IRONPLATE   => :STEEL,
      :FLAMEPLATE  => :FIRE,
      :SPLASHPLATE => :WATER,
      :MEADOWPLATE => :GRASS,
      :ZAPPLATE    => :ELECTRIC,
      :MINDPLATE   => :PSYCHIC,
      :ICICLEPLATE => :ICE,
      :DRACOPLATE  => :DRAGON,
      :DREADPLATE  => :DARK,
      :PIXIEPLATE  => :FAIRY
    }
  end

  def pbBaseType(user)
    ret = :NORMAL
   if user.itemActive?
      @itemTypes.each do |item, itemType|
        next if user.item != item
        ret = itemType if GameData::Type.exists?(itemType)
        break
      end
    end
    
  if user.isSpecies?(:ARCEUS) && user.hasActiveAbility?(:MULTITYPE) && user.hasActiveItem?( :LEGENDPLATE)
    choice = @battle.choices[user.index]
    targets = user.pbFindTargets(choice, self, user)
    targets = user.pbChangeTargets(self, user, targets)
    target = targets[0]
  if target != nil
    targetTypes = target.pbTypes(true)
    bestType = nil
    bestMultiplier = 0
    bestMultiplier2 = 1.0 / 0.0 # initialize to infinity
    GameData::Type.each do |type|
#Prevents abilities to make the target immune to some moves    
 if (type == :GROUND && target.airborne?) ||
         (type == :WATER && (target.hasActiveAbility?([:DRYSKIN, :STORMDRAIN, :WATERABSORB])||target.effectiveWeather == :HarshSun)) ||
         (type == :FIRE && (target.hasActiveAbility?(:FLASHFIRE)||target.effectiveWeather == :HeavyRain)) ||
         (type == :GRASS && target.hasActiveAbility?(:SAPSIPPER)) ||
         (type == :ELECTRIC && target.hasActiveAbility?([:LIGHTNINGROD, :MOTORDRIVE, :VOLTABSORB]))
      next
      end
    multiplier = targetTypes.inject(1) { |m, targetType| m * Effectiveness.calculate_one(type.id, targetType) }
    multiplier2 = targetTypes.inject(0) { |m, targetType| m + Effectiveness.calculate_one(targetType, type.id) }
    
 #In case of weather, account for the new effectiveness  
 if (type == :WATER && target.effectiveWeather == :Sun) ||
       (type == :FIRE && target.effectiveWeather == :Rain) 
        multiplier = multiplier / 2   
        end
    if multiplier < bestMultiplier || multiplier == 0
        next
        end
    if multiplier > bestMultiplier
        bestType = type.id
        bestMultiplier = multiplier
        bestMultiplier2 = multiplier2
    elsif multiplier == bestMultiplier && multiplier2 <= bestMultiplier2
        bestType = type.id
        bestMultiplier = multiplier
        bestMultiplier2 = multiplier2 
      end
    end

      # Change the user's form to the form corresponding to the identified type
      typeArray = {
        :NORMAL => 0,
        :FIGHTING => 1,
        :FLYING => 2,
        :POISON => 3,
        :GROUND => 4,
        :ROCK => 5,
        :BUG => 6,
        :GHOST => 7,
        :STEEL => 8,
        :FIRE => 10,
        :WATER => 11,
        :GRASS => 12,
        :ELECTRIC => 13,
        :PSYCHIC => 14,
        :ICE => 15,
        :DRAGON => 16,
        :DARK => 17,
        :FAIRY => 18
      }
      newForm = typeArray[bestType.to_sym] 
      user.pbChangeForm(newForm,_INTL("{1} becomes {3}'s type to match {2}'s weakness!", user.pbThis, target.pbThis(lowerCase = true), GameData::Type.get(bestType).name))
      return bestType
    else
      # Return the move's original type if the conditions are not met
      return ret
    end
  end 
  
    return ret
  end
end

Code:
Expand Collapse Copy
MultipleForms.register(:ARCEUS, {
  "getForm" => proc { |pkmn|
    next nil if !pkmn.hasAbility?(:MULTITYPE)
    typeArray = {
      1  => [:FISTPLATE,   :FIGHTINIUMZ],
      2  => [:SKYPLATE,    :FLYINIUMZ],
      3  => [:TOXICPLATE,  :POISONIUMZ],
      4  => [:EARTHPLATE,  :GROUNDIUMZ],
      5  => [:STONEPLATE,  :ROCKIUMZ],
      6  => [:INSECTPLATE, :BUGINIUMZ],
      7  => [:SPOOKYPLATE, :GHOSTIUMZ],
      8  => [:IRONPLATE,   :STEELIUMZ],
      10 => [:FLAMEPLATE,  :FIRIUMZ],
      11 => [:SPLASHPLATE, :WATERIUMZ],
      12 => [:MEADOWPLATE, :GRASSIUMZ],
      13 => [:ZAPPLATE,    :ELECTRIUMZ],
      14 => [:MINDPLATE,   :PSYCHIUMZ],
      15 => [:ICICLEPLATE, :ICIUMZ],
      16 => [:DRACOPLATE,  :DRAGONIUMZ],
      17 => [:DREADPLATE,  :DARKINIUMZ],
      18 => [:PIXIEPLATE,  :FAIRIUMZ]
    }
    ret = 0
    typeArray.each do |f, items|
      items.each do |item|
        next if !pkmn.hasItem?(item)
        ret = f
        break
      end
      break if ret > 0
    end
    next ret
  },
    "getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle|
    if pkmn.hasItem?(:LEGENDPLATE)
    next 0
    end
  }
})

Code:
Expand Collapse Copy
def unlosable?(species, ability)
      return false if species == :ARCEUS && ability != :MULTITYPE
      return false if species == :SILVALLY && ability != :RKSSYSTEM
      combos = {
        :ARCEUS    => [:FISTPLATE,   :FIGHTINIUMZ,
                       :SKYPLATE,    :FLYINIUMZ,
                       :TOXICPLATE,  :POISONIUMZ,
                       :EARTHPLATE,  :GROUNDIUMZ,
                       :STONEPLATE,  :ROCKIUMZ,
                       :INSECTPLATE, :BUGINIUMZ,
                       :SPOOKYPLATE, :GHOSTIUMZ,
                       :IRONPLATE,   :STEELIUMZ,
                       :FLAMEPLATE,  :FIRIUMZ,
                       :SPLASHPLATE, :WATERIUMZ,
                       :MEADOWPLATE, :GRASSIUMZ,
                       :ZAPPLATE,    :ELECTRIUMZ,
                       :MINDPLATE,   :PSYCHIUMZ,
                       :ICICLEPLATE, :ICIUMZ,
                       :DRACOPLATE,  :DRAGONIUMZ,
                       :DREADPLATE,  :DARKINIUMZ,
                       :PIXIEPLATE,  :FAIRIUMZ,
                       :LEGENDPLATE],

Please feel free to tell me if there is any bug !
Credits
Eskiss
Lucidious 89 for his precious help
No credits requiered
Author
Eskiss
Views
2,066
First release
Last update

Ratings

0.00 star(s) 0 ratings
Back
Top