{
  name: "God-Killing Blade",
  rating: 5,
  flags: {},
  onStart(pokemon) {
    this.add("-ability", pokemon, "God-Killing Blade");
  },
  onModifyPriority(priority, pokemon, target, move) {
    if (!move || move.type !== "Steel") return;
    this.add("-activate", pokemon, "ability: God-Killing Blade");
    return priority + 1;
  },
  poisonStatusFromMove(move) {
    if (!move || move.type !== "Poison") return null;
    if (move.status === "psn" || move.status === "tox") return {status: move.status, chance: 100};
    const secondaries = [];
    if (move.secondary) secondaries.push(move.secondary);
    if (Array.isArray(move.secondaries)) secondaries.push(...move.secondaries);
    for (const secondary of secondaries) {
      if (!secondary || (secondary.status !== "psn" && secondary.status !== "tox")) continue;
      return {status: secondary.status, chance: typeof secondary.chance === "number" ? secondary.chance : 100};
    }
    return null;
  },
  onModifyMove(move, pokemon, target) {
    if (!move) return;
    const poisonEffect = this.effect.poisonStatusFromMove.call(this, move);
    if (poisonEffect) {
      move.ignoreImmunity = true;
      move.godKillingBladePoisonStatus = poisonEffect.status;
      move.godKillingBladePoisonChance = poisonEffect.chance;
      if (move.category === "Status" && target?.hasType?.("Steel") && !move.godKillingBladeWrapped) {
        const originalOnHit = move.onHit;
        delete move.status;
        move.onHit = function(target, source, activeMove) {
          let result;
          if (originalOnHit) result = originalOnHit.call(this, target, source, activeMove);
          let statusResult;
          if (source?.hasAbility?.("godkillingblade") && target?.hasType?.("Steel") && !target.status) {
            const status = activeMove?.godKillingBladePoisonStatus || poisonEffect.status;
            statusResult = target.setStatus(status, source, activeMove, true);
          }
          return result === undefined ? statusResult : result;
        };
        move.godKillingBladeWrapped = true;
      }
    }
    if (!target) return;
    if (target.status === "psn" || target.status === "tox" || target.ginKamishiniSliver || target.volatiles?.kamishinisliver) {
      move.ignoreDefensive = true;
    }
  },
  onSourceAfterMoveSecondary(target, source, move) {
    if (!source || !source.hasAbility?.("godkillingblade")) return;
    if (!target || target.fainted || target.status) return;
    if (!target.hasType?.("Steel")) return;
    const poisonEffect = this.effect.poisonStatusFromMove.call(this, move);
    if (!poisonEffect) return;
    if (poisonEffect.chance < 100 && !this.randomChance(poisonEffect.chance, 100)) return;
    target.setStatus(poisonEffect.status, source, move, true);
  },
  onResidualOrder: 23,
  onResidual(pokemon) {
    if (!pokemon || pokemon.fainted) return;
    const foes = pokemon.foes ? pokemon.foes() : pokemon.side?.foe?.active || [];
    for (const foe of foes) {
      if (!foe || foe.fainted) continue;
      if (foe.ginKamishiniSliver && !foe.volatiles?.kamishinisliver) foe.addVolatile("kamishinisliver", pokemon, null);
    }
  }
}
