✓ ESS21仅限 【求助帖】关于一个自创特性的问题

韩英鑫1111

宝可梦训练家
成员
2024-04-05
7
0
220
22
写了一个复合特性,如图%8H1}Y2]G`@@)T8KGH{O]BN.png)UD(0W0U4MCIZJH~NY(2V$T.png
图里的概率为了测试调整过,在运行测试时可以进入游戏,可以进入战斗,但是战斗中被对面打中就会有这个弹窗报错
VL4V%R5{(ROL`L4_71CSZ(Y_tmb.jpg我不太清楚这个特性报错的点在哪里,如果是在triggerOnBeingHit里的话,我是哪里少写了吗
 

韩英鑫1111

宝可梦训练家
成员
2024-04-05
7
0
220
22
pbFreeze後面只需要一個參數,你寫了兩個給他。

浏览附件2116
好的鬼佬,我电脑拿去修了,今天刚看论坛,请问是这么改对吗
Ruby:
#寒气
Battle::AbilityEffects::OnEndOfUsingMove.add(:FROZENAIR,
  proc { |ability, user, targets, move, battle|
      next if move.type != :ICE
      next if !move.contactMove?
      next if battle.pbRandom(100) >= 99
      battle.pbShowAbilitySplash(user)
      if targets.hasActiveAbility?(:SHIELDDUST) && !battle.moldBreaker
        battle.pbShowAbilitySplash(targets)
        if !Battle::Scene::USE_ABILITY_SPLASH
          battle.pbDisplay(_INTL("对于{1},完全没有效果!", targets.pbThis))
        end
        battle.pbHideAbilitySplash(targets)
      elsif targets.pbCanFreeze?(user, Battle::Scene::USE_ABILITY_SPLASH)
        msg = nil
        if !Battle::Scene::USE_ABILITY_SPLASH
          msg = _INTL("{1}的{2}让{3}冰冻了!", user.pbThis, user.abilityName, targets.pbThis(true))
        end
        targets.pbFreeze(msg)
      end
   battle.pbHideAbilitySplash(user)
  }
)

Battle::AbilityEffects::OnDealingHit.add(:FROZENAIR,
  proc { |ability, user, target, move, battle|
    next if !move.contactMove?
    next if battle.pbRandom(100) >= 99
    battle.pbShowAbilitySplash(user)
    if target.hasActiveAbility?(:SHIELDDUST) && !battle.moldBreaker
      battle.pbShowAbilitySplash(target)
      if !Battle::Scene::USE_ABILITY_SPLASH
        battle.pbDisplay(_INTL("对于{1},完全没有效果!", target.pbThis))
      end
      battle.pbHideAbilitySplash(target)
    elsif target.pbCanFreeze?(user, Battle::Scene::USE_ABILITY_SPLASH)
      msg = nil
      if !Battle::Scene::USE_ABILITY_SPLASH
        msg = _INTL("{1}的{2}让{3}冰冻了!", user.pbThis, user.abilityName, target.pbThis(true))
      end
      target.pbFreeze(msg)
    end
    battle.pbHideAbilitySplash(user)
  }
)

Battle::AbilityEffects::OnBeingHit.add(:FROZENAIR,
  proc { |ability, user, target, move, battle|
    next if !move.pbContactMove?(user)
    next if user.frozen? || battle.pbRandom(100) >= 99
    battle.pbShowAbilitySplash(target)
    if user.pbCanFreeze?(target, Battle::Scene::USE_ABILITY_SPLASH) &&
       user.affectedByContactEffect?(Battle::Scene::USE_ABILITY_SPLASH)
      msg = nil
      if !Battle::Scene::USE_ABILITY_SPLASH
        msg = _INTL("{1}的{2}让{3}被冰冻了!", target.pbThis, target.abilityName, user.pbThis(true))
      end
      user.pbFreeze(msg)
    end
    battle.pbHideAbilitySplash(target)
  }
)
 

附件

  • SYJOBIM)AHV5G06V3{$B`UJ.png
    SYJOBIM)AHV5G06V3{$B`UJ.png
    153.3 KB · 查看: 4
最后编辑:

韩英鑫1111

宝可梦训练家
成员
2024-04-05
7
0
220
22
不能对数组调用hasActiveAbility?方法,这是一个battler级的方法。
好的,谢谢TA佬,那这里我应该调用哪个呢?OnDealingHit这段我完全抄的毒手,应该没有什么问题才对。前面OnEndOfUsingMove这段我应该调用哪个方法呢?
 

韩英鑫1111

宝可梦训练家
成员
2024-04-05
7
0
220
22
不能对数组调用hasActiveAbility?方法,这是一个battler级的方法。
请问是像这样吗?
代码:
Battle::AbilityEffects::OnDealingHit.add(:FROZENAIR,
  proc { |ability, user, target, move, battle|
    next if !move.contactMove? || move.type != :ICE
    next if battle.pbRandom(100) >= 99
    battle.pbShowAbilitySplash(user)
    if target.hasActiveAbility?(:SHIELDDUST) && !battle.moldBreaker
      battle.pbShowAbilitySplash(target)
      if !Battle::Scene::USE_ABILITY_SPLASH
        battle.pbDisplay(_INTL("对于{1},完全没有效果!", target.pbThis))
      end
      battle.pbHideAbilitySplash(target)
    elsif target.pbCanFreeze?(user, Battle::Scene::USE_ABILITY_SPLASH)
      msg = nil
      if !Battle::Scene::USE_ABILITY_SPLASH
        msg = _INTL("{1}的{2}让{3}冰冻了!", user.pbThis, user.abilityName, target.pbThis(true))
      end
      target.pbFreeze(msg)
    end
    battle.pbHideAbilitySplash(user)
  }
)

Battle::AbilityEffects::OnBeingHit.add(:FROZENAIR,
  proc { |ability, user, target, move, battle|
    next if !move.pbContactMove?(user)
    next if user.frozen? || battle.pbRandom(100) >= 99
    battle.pbShowAbilitySplash(target)
    if user.pbCanFreeze?(target, Battle::Scene::USE_ABILITY_SPLASH) &&
       user.affectedByContactEffect?(Battle::Scene::USE_ABILITY_SPLASH)
      msg = nil
      if !Battle::Scene::USE_ABILITY_SPLASH
        msg = _INTL("{1}的{2}让{3}被冰冻了!", target.pbThis, target.abilityName, user.pbThis(true))
      end
      user.pbFreeze(msg)
    end
    battle.pbHideAbilitySplash(target)
  }
)
 

TAAAAAAA

馆主
成员
2024-06-16
75
12
805
请问是像这样吗?
代码:
Battle::AbilityEffects::OnDealingHit.add(:FROZENAIR,
  proc { |ability, user, target, move, battle|
    next if !move.contactMove? || move.type != :ICE
    next if battle.pbRandom(100) >= 99
    battle.pbShowAbilitySplash(user)
    if target.hasActiveAbility?(:SHIELDDUST) && !battle.moldBreaker
      battle.pbShowAbilitySplash(target)
      if !Battle::Scene::USE_ABILITY_SPLASH
        battle.pbDisplay(_INTL("对于{1},完全没有效果!", target.pbThis))
      end
      battle.pbHideAbilitySplash(target)
    elsif target.pbCanFreeze?(user, Battle::Scene::USE_ABILITY_SPLASH)
      msg = nil
      if !Battle::Scene::USE_ABILITY_SPLASH
        msg = _INTL("{1}的{2}让{3}冰冻了!", user.pbThis, user.abilityName, target.pbThis(true))
      end
      target.pbFreeze(msg)
    end
    battle.pbHideAbilitySplash(user)
  }
)

Battle::AbilityEffects::OnBeingHit.add(:FROZENAIR,
  proc { |ability, user, target, move, battle|
    next if !move.pbContactMove?(user)
    next if user.frozen? || battle.pbRandom(100) >= 99
    battle.pbShowAbilitySplash(target)
    if user.pbCanFreeze?(target, Battle::Scene::USE_ABILITY_SPLASH) &&
       user.affectedByContactEffect?(Battle::Scene::USE_ABILITY_SPLASH)
      msg = nil
      if !Battle::Scene::USE_ABILITY_SPLASH
        msg = _INTL("{1}的{2}让{3}被冰冻了!", target.pbThis, target.abilityName, user.pbThis(true))
      end
      user.pbFreeze(msg)
    end
    battle.pbHideAbilitySplash(target)
  }
)
不是,next if !move.contactMove? || move.type != :ICE改成next if !move.contactMove? && move.type != :ICE。
 

在线成员

论坛统计

主题
409
消息
1,866
会员
2,655
最新会员
ant2183

关于我们

  • 宝可梦以及其他相关名称是任天堂的商标,版权归宝可梦公司所有。宝可饭堂是一个同人游戏中文社区,不隶属于宝可梦公司。在宝可饭堂上的粉丝游戏亦未获得其授权,请支持正版游戏。
© 2022- pokefans.cn
点此延长宝可饭堂生命