Help Extra Types Effectiveness

PokeMiner20

Novice
Member
Posts
15
#1
utilizing this (https://www.pokecommunity.com/showthread.php?t=391589) tutorial and common sense, I've experimented in attempting an all 18 type Pokemon. I've tried 18 types but it causes an overflow issue with the byte data and downgraded to 15 (16 might be the highest, as 17 also overflows). I'm basically stuck on step 5, but with my extra 12 types. this is purely for curiosity reasons and just to say I achieved it, but I can't common sense the code to work with all types and my latest attempt hasn't worked either. (I'm testing with a 15 type Arceus that has ground type as type #5 and electric attacks hit it.) this is my current code.

Ruby:
class PBTypes

  @@TypeData = nil

  def PBTypes.loadTypeData
    if !@@TypeData
      @@TypeData = load_data("Data/types.dat")
      @@TypeData[0].freeze
      @@TypeData[1].freeze
      @@TypeData[2].freeze
      @@TypeData[3].freeze
      @@TypeData[4].freeze
      @@TypeData[5].freeze
      @@TypeData[6].freeze
      @@TypeData[7].freeze
      @@TypeData[8].freeze
      @@TypeData[9].freeze
      @@TypeData[10].freeze
      @@TypeData[11].freeze
      @@TypeData[12].freeze
      @@TypeData[13].freeze
      @@TypeData[14].freeze
      @@TypeData.freeze
    end
    return @@TypeData
  end

  def PBTypes.isPseudoType?(type)
    return PBTypes.loadTypeData()[0].include?(type)
  end

  def PBTypes.isSpecialType?(type)
    return PBTypes.loadTypeData()[1].include?(type)
  end

  def PBTypes.getEffectiveness(attackType,opponentType)
    return 2 if !opponentType || opponentType<0
    return PBTypes.loadTypeData()[2][attackType*(PBTypes.maxValue+1)+opponentType]
  end

  def PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2=nil,opponentType3=nil,opponentType4=nil,opponentType5=nil,opponentType6=nil,opponentType7=nil,opponentType8=nil,opponentType9=nil,opponentType10=nil,opponentType11=nil,opponentType12=nil,opponentType13=nil,opponentType14=nil,opponentType15=nil)
    mod1  = PBTypes.getEffectiveness(attackType,opponentType1)
    mod2  = 2
    mod3  = 2
    mod4  = 2
    mod5  = 2
    mod6  = 2
    mod7  = 2
    mod8  = 2
    mod9  = 2
    mod10 = 2
    mod11 = 2
    mod12 = 2
    mod13 = 2
    mod14 = 2
    mod15 = 2
    if opponentType2!=nil && opponentType2>=0 && opponentType1!=opponentType2
      mod2 = PBTypes.getEffectiveness(attackType,opponentType2)
    end
    if opponentType3!=nil && opponentType3>=0 &&
       opponentType1!=opponentType3 && opponentType2!=opponentType3
      mod3 = PBTypes.getEffectiveness(attackType,opponentType3)
    end
    if opponentType4!=nil && opponentType4>=0 &&
       opponentType1!=opponentType4 && opponentType2!=opponentType4 &&
       opponentType3!=opponentType4
      mod4 = PBTypes.getEffectiveness(attackType,opponentType4)
    end
    if opponentType5!=nil && opponentType5>=0 &&
       opponentType1!=opponentType5 && opponentType2!=opponentType5 &&
       opponentType3!=opponentType5 && opponentType4!=opponentType5
      mod5 = PBTypes.getEffectiveness(attackType,opponentType5)
    end
    if opponentType6!=nil && opponentType6>=0 &&
       opponentType1!=opponentType6 && opponentType2!=opponentType6 &&
       opponentType3!=opponentType6 && opponentType4!=opponentType6 &&
       opponentType5!=opponentType6
      mod6 = PBTypes.getEffectiveness(attackType,opponentType6)
    end
    if opponentType7!=nil && opponentType7>=0 &&
       opponentType1!=opponentType7 && opponentType2!=opponentType7 &&
       opponentType3!=opponentType7 && opponentType4!=opponentType7 &&
       opponentType5!=opponentType7 && opponentType6!=opponentType7
      mod7 = PBTypes.getEffectiveness(attackType,opponentType7)
    end
    if opponentType8!=nil && opponentType8>=0 &&
       opponentType1!=opponentType8 && opponentType2!=opponentType8 &&
       opponentType3!=opponentType8 && opponentType4!=opponentType8 &&
       opponentType5!=opponentType8 && opponentType6!=opponentType8 &&
       opponentType7!=opponentType8
      mod8 = PBTypes.getEffectiveness(attackType,opponentType8)
    end
    if opponentType9!=nil && opponentType9>=0 &&
       opponentType1!=opponentType9 && opponentType2!=opponentType9 &&
       opponentType3!=opponentType9 && opponentType4!=opponentType9 &&
       opponentType5!=opponentType9 && opponentType6!=opponentType9 &&
       opponentType7!=opponentType9 && opponentType8!=opponentType9
      mod9 = PBTypes.getEffectiveness(attackType,opponentType9)
    end
    if opponentType10!=nil && opponentType10>=0 &&
       opponentType1!=opponentType10 && opponentType2!=opponentType10 &&
       opponentType3!=opponentType10 && opponentType4!=opponentType10 &&
       opponentType5!=opponentType10 && opponentType6!=opponentType10 &&
       opponentType7!=opponentType10 && opponentType8!=opponentType10 &&
       opponentType9!=opponentType10
      mod10 = PBTypes.getEffectiveness(attackType,opponentType10)
    end
    if opponentType11!=nil && opponentType11>=0 &&
       opponentType1!=opponentType11 && opponentType2!=opponentType11 &&
       opponentType3!=opponentType11 && opponentType4!=opponentType11 &&
       opponentType5!=opponentType11 && opponentType6!=opponentType11 &&
       opponentType7!=opponentType11 && opponentType8!=opponentType11 &&
       opponentType9!=opponentType11 && opponentType10!=opponentType11
      mod11 = PBTypes.getEffectiveness(attackType,opponentType11)
    end
    if opponentType12!=nil && opponentType12>=0 &&
       opponentType1!=opponentType12 && opponentType2!=opponentType12 &&
       opponentType3!=opponentType12 && opponentType4!=opponentType12 &&
       opponentType5!=opponentType12 && opponentType6!=opponentType12 &&
       opponentType7!=opponentType12 && opponentType8!=opponentType12 &&
       opponentType9!=opponentType12 && opponentType10!=opponentType12 &&
       opponentType11!=opponentType12
      mod12 = PBTypes.getEffectiveness(attackType,opponentType12)
    end
    if opponentType13!=nil && opponentType13>=0 &&
       opponentType1!=opponentType13 && opponentType2!=opponentType13 &&
       opponentType3!=opponentType13 && opponentType4!=opponentType13 &&
       opponentType5!=opponentType13 && opponentType6!=opponentType13 &&
       opponentType7!=opponentType13 && opponentType8!=opponentType13 &&
       opponentType9!=opponentType13 && opponentType10!=opponentType13 &&
       opponentType11!=opponentType13 && opponentType12!=opponentType13
      mod13 = PBTypes.getEffectiveness(attackType,opponentType13)
    end
    if opponentType14!=nil && opponentType14>=0 &&
       opponentType1!=opponentType14 && opponentType2!=opponentType14 &&
       opponentType3!=opponentType14 && opponentType4!=opponentType14 &&
       opponentType5!=opponentType14 && opponentType6!=opponentType14 &&
       opponentType7!=opponentType14 && opponentType8!=opponentType14 &&
       opponentType9!=opponentType14 && opponentType10!=opponentType14 &&
       opponentType11!=opponentType14 && opponentType12!=opponentType14 &&
       opponentType13!=opponentType14
      mod14 = PBTypes.getEffectiveness(attackType,opponentType14)
    end
    if opponentType15!=nil && opponentType15>=0 &&
       opponentType1!=opponentType15 && opponentType2!=opponentType15 &&
       opponentType3!=opponentType15 && opponentType4!=opponentType15 &&
       opponentType5!=opponentType15 && opponentType6!=opponentType15 &&
       opponentType7!=opponentType15 && opponentType8!=opponentType15 &&
       opponentType9!=opponentType15 && opponentType10!=opponentType15 &&
       opponentType11!=opponentType15 && opponentType12!=opponentType15 &&
       opponentType13!=opponentType15 && opponentType14!=opponentType15
      mod15 = PBTypes.getEffectiveness(attackType,opponentType15)
    end
    return (mod1*mod2*mod3*mod4*mod5*mod6*mod7*mod8*mod9*mod10*mod11*mod12*mod13*mod14*mod15)
  end
  def PBTypes.isIneffective?(attackType,opponentType1,opponentType2=nil,opponentType3=nil,opponentType4=nil,opponentType5=nil,opponentType6=nil,opponentType7=nil,opponentType8=nil,opponentType9=nil,opponentType10=nil,opponentType11=nil,opponentType12=nil,opponentType13=nil,opponentType14=nil,opponentType15=nil)
    e = PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2,opponentType3,opponentType4,opponentType5,opponentType6,opponentType7,opponentType8,opponentType9,opponentType10,opponentType11,opponentType12,opponentType13,opponentType14,opponentType15)
    return e==0
  end

  def PBTypes.isNotVeryEffective?(attackType,opponentType1,opponentType2=nil,opponentType3=nil,opponentType4=nil,opponentType5=nil,opponentType6=nil,opponentType7=nil,opponentType8=nil,opponentType9=nil,opponentType10=nil,opponentType11=nil,opponentType12=nil,opponentType13=nil,opponentType14=nil,opponentType15=nil)
    e = PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2,opponentType3,opponentType4,opponentType5,opponentType6,opponentType7,opponentType8,opponentType9,opponentType10,opponentType11,opponentType12,opponentType13,opponentType14,opponentType15)
    return e>0 && e<8
  end

  def PBTypes.isNormalEffective?(attackType,opponentType1,opponentType2=nil,opponentType3=nil,opponentType4=nil,opponentType5=nil,opponentType6=nil,opponentType7=nil,opponentType8=nil,opponentType9=nil,opponentType10=nil,opponentType11=nil,opponentType12=nil,opponentType13=nil,opponentType14=nil,opponentType15=nil)
    e = PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2,opponentType3,opponentType4,opponentType5,opponentType6,opponentType7,opponentType8,opponentType9,opponentType10,opponentType11,opponentType12,opponentType13,opponentType14,opponentType15)
    return e==8
  end

  def PBTypes.isSuperEffective?(attackType,opponentType1,opponentType2=nil,opponentType3=nil,opponentType4=nil,opponentType5=nil,opponentType6=nil,opponentType7=nil,opponentType8=nil,opponentType9=nil,opponentType10=nil,opponentType11=nil,opponentType12=nil,opponentType13=nil,opponentType14=nil,opponentType15=nil)
    e = PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2,opponentType3,opponentType4,opponentType5,opponentType6,opponentType7,opponentType8,opponentType9,opponentType10,opponentType11,opponentType12,opponentType13,opponentType14,opponentType15)
    return e>8
  end
end
besides length, anything looking scuffed?
 

PokeMiner20

Novice
Member
Posts
15
#2
Upon looking more on google, and locating more attempts to add anymore than 3 typings, it seems link the only think these add-ons have in common is no matter what, type effectiveness doesn't work for any of them. I was able to locate the original "Step 5" thread and even with a downloadable copy of essentials with this mod, type 3 effectiveness still doesn't work, be it how the formula acts, or if it needs a complete overhaul, upon giving a Pokemon ground type and fighting an electric type, those electric moves still do damage while in the type 3 position. seems like most type 3 dreams are crushed, but I shall locate a method that works.
 
Top