<commit_before><?php
/**
 * BMSkillRadioactive: Code specific to the radioactive die skill
 *
 * @author james
 */

/**
 * This class contains code specific to the radioactive die skill
 */
class BMSkillRadioactive extends BMSkill {
    public static $hooked_methods = array('capture', 'be_captured');

    public static function capture(&$args) {
        self::radioactive_split($args);
    }

    public static function be_captured(&$args) {
        self::radioactive_split($args);
    }

    protected static function radioactive_split(&$args) {
        if (!is_array($args)) {
            return;
        }

        if (!array_key_exists('attackers', $args)) {
            return;
        }

        if (!array_key_exists('defenders', $args)) {
            return;
        }

        if (count($args['attackers']) != 1) {
            return;
        }

        if (count($args['defenders']) != 1) {
            return;
        }

        $attacker = &$args['attackers'][0];
        $game = $attacker->ownerObject;
        $activeDieArrayArray = $game->activeDieArrayArray;

        $attacker->remove_skill('Radioactive');
        $attacker->remove_skill('Turbo');
        $attacker->remove_skill('Mood');
        $attacker->remove_skill('Mad');
        $attacker->remove_skill('Jolt');
        $attacker->remove_skill('TimeAndSpace');

        $newAttackerDieArray = $attacker->split();

        array_splice(
            $activeDieArrayArray[$attacker->playerIdx],
            $attacker->activeDieIdx,
            1,
            $newAttackerDieArray
        );

        array_splice(
            $args['attackers'],
            0,
            1,
            $newAttackerDieArray
        );

        $game->activeDieArrayArray = $activeDieArrayArray;
    }

    protected static function get_description() {
        return 'If a radioactive die is either the attacking die or target die in an attack with a ' .
               'single attacking die and a single target die, the attacking die splits, or "decays", ' .
               'into two as-close-to-equal-sized-as-possible dice that add up to its original size. All ' .
               'dice that decay lose the following skills: Radioactive (%), Turbo Swing(!), Mood ' .
               'Swing(?), [and, not yet implemented: Jolt(J), and Time and Space(^)]. For example, ' .
               'a sX! (Shadow Turbo X Swing) with 15 sides that shadow attacked a radioactive die ' .
               'would decay into a s7 and a s8 sided die losing the turbo skill. A %p(7,13) on a ' .
               'power attack would decay into a p(3,7) and a p(4,6) losing the radioactive skill.';
    }

    protected static function get_interaction_descriptions() {
        return array(<commit_msg>Fixed description of radioactive<commit_after><?php
/**
 * BMSkillRadioactive: Code specific to the radioactive die skill
 *
 * @author james
 */

/**
 * This class contains code specific to the radioactive die skill
 */
class BMSkillRadioactive extends BMSkill {
    public static $hooked_methods = array('capture', 'be_captured');

    public static function capture(&$args) {
        self::radioactive_split($args);
    }

    public static function be_captured(&$args) {
        self::radioactive_split($args);
    }

    protected static function radioactive_split(&$args) {
        if (!is_array($args)) {
            return;
        }

        if (!array_key_exists('attackers', $args)) {
            return;
        }

        if (!array_key_exists('defenders', $args)) {
            return;
        }

        if (count($args['attackers']) != 1) {
            return;
        }

        if (count($args['defenders']) != 1) {
            return;
        }

        $attacker = &$args['attackers'][0];
        $game = $attacker->ownerObject;
        $activeDieArrayArray = $game->activeDieArrayArray;

        $attacker->remove_skill('Radioactive');
        $attacker->remove_skill('Turbo');
        $attacker->remove_skill('Mood');
        $attacker->remove_skill('Mad');
        $attacker->remove_skill('Jolt');
        $attacker->remove_skill('TimeAndSpace');

        $newAttackerDieArray = $attacker->split();

        array_splice(
            $activeDieArrayArray[$attacker->playerIdx],
            $attacker->activeDieIdx,
            1,
            $newAttackerDieArray
        );

        array_splice(
            $args['attackers'],
            0,
            1,
            $newAttackerDieArray
        );

        $game->activeDieArrayArray = $activeDieArrayArray;
    }

    protected static function get_description() {
        return 'If a radioactive die is either the attacking die or the target die in an attack with a ' .
               'single attacking die and a single target die, the attacking die splits, or "decays", ' .
               'into two as-close-to-equal-sized-as-possible dice that add up to its original size. All ' .
               'dice that decay lose the following skills: Radioactive (%), Turbo Swing(!), Mood ' .
               'Swing(?), [and, not yet implemented: Jolt(J), and Time and Space(^)]. For example, ' .
               'a sX! (Shadow Turbo X Swing) with 15 sides that shadow attacked a radioactive die ' .
               'would decay into a s7 and a s8 sided die losing the turbo skill. A %p(7,13) on a ' .
               'power attack would decay into a p(3,7) and a p(4,6) losing the radioactive skill.';
    }

    protected static function get_interaction_descriptions() {
        return array(
{'fraction_non_alphanumeric': 0.11638479723586106, 'fraction_numerical': 0.006182942353155119, 'mean_word_length': 2.2144944476914086, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2866940', 'n_tokens_mistral': 1580, 'n_tokens_neox': 1513, 'n_words': 429}