Gbf Wikia
Advertisement

เอกสารการใช้งานสำหรับมอดูลนี้อาจสร้างขึ้นที่ มอดูล:TranslateEffect/doc

--Categories:
--[[Category:Modules/Formatting]]

local FormattingEffect = require('Module:FormattingEffect')
local TranslateEffect = {}

local _all = {
--Damage
    ["火属性ダメージ$"] = {
        _how = "attack",
        _how_attribute = 1,
    },
    ["水属性ダメージ$"] = {
        _how = "attack",
        _how_attribute = 2,
    },
    ["土属性ダメージ$"] = {
        _how = "attack",
        _how_attribute = 3,
    },
    ["風属性ダメージ$"] = {
        _how = "attack",
        _how_attribute = 4,
    },
    ["光属性ダメージ$"] = {
        _how = "attack",
        _how_attribute = 5,
    },
    ["闇属性ダメージ$"] = {
        _how = "attack",
        _how_attribute = 6,
    },
    ["^追加ダメージ"] = {
        _how = "add_damage",
    },
    ["火属性追加ダメージ"] = {
        _how = "add_damage",
        _how_attribute = 1,
    },
    ["無属性追加ダメージ"] = {
        _how = "add_damage",
        _how_attribute = 7,
    },
    ["敵に自属性ダメージ"] = {
        _how = "attack",
        _how_attribute = 0,
    },
    ["武器属性ダメージ$"] = {
        _how = "attack",
        _how_attribute = 10,
    },
    ["オーバードライブ時の敵に4倍自属性ダメージ"] = {
        _when = "overdrive_opponent",
        _how = "attack",
        _how_attribute = 0,
        _amount = 4,
        _amount_unit = "fold",
    },
    ["オーバードライブ時の敵に4~5倍自属性ダメージ"] = {
        _when = "overdrive_opponent",
        _how = "attack",
        _how_attribute = 0,
        _amount = "4-5",
        _amount_unit = "fold",
    },
    ["オーバードライブ時の敵に5倍自属性ダメージ"] = {
        _when = "overdrive_opponent",
        _how = "attack",
        _how_attribute = 0,
        _amount = 5,
        _amount_unit = "fold",
    },
    ["対象がオーバードライブ時追加ダメージ"] = {
        _when = "overdrive_opponent",
        _how = "add_damage",
    },
    ["対象がブレイク時に追加ダメージ"] = {
        _when = "break",
        _how = "add_damage",
    },

--Heal
    ["自分のHP回復"] = {
        _how = "heal",
        _object = "hp",
        _target = "self",
    },
    ["自分のHPを回復"] = {
        _how = "heal",
        _object = "hp",
        _target = "self",
    },
    ["^HP回復"] = {
        _how = "heal",
        _object = "hp",
    },
    ["参戦者のHPを回復"] = {
        _how = "heal",
        _object = "hp",
        _target = "player_all",
    },
    ["味方全体に再生効果"] = {
        _how = "regen",
        _target = "party_all",
    },

--Buff
    ["攻防UP"] = {
        _how = "increase",
        _object = "attack_defense_power",
    },
 --Attack
    ["^攻撃UP"] = {
        _how = "increase",
        _object = "attack_power",
    },
    ["攻撃力上昇"] = {
        _how = "increase",
        _object = "attack_power",
    },
    ["自分の攻撃UP"] = {
        _how = "increase",
        _object = "attack_power",
        _target = "self",
    },
    ["味方全体の攻撃UP"] = {
        _how = "increase",
        _object = "attack_power",
        _target = "party_all",
    },
    ["参戦者の攻撃UP"] = {
        _how = "increase",
        _object = "attack_power",
        _target = "player_all",
    },
    ["味方全体の火属性攻撃UP"] = {
        _how = "increase",
        _object = "attack_power",
        _how_attribute = 1,
        _target = "party_all",
    },
    ["参戦者の火属性攻撃UP"] = {
        _how = "increase",
        _object = "attack_power",
        _how_attribute = 1,
        _target = "player_all",
    },
    ["味方全体の水属性攻撃UP"] = {
        _how = "increase",
        _object = "attack_power",
        _how_attribute = 2,
        _target = "party_all",
    },
    ["参戦者の水属性攻撃UP"] = {
        _how = "increase",
        _object = "attack_power",
        _how_attribute = 2,
        _target = "player_all",
    },
    ["味方全体の土属性攻撃UP"] = {
        _how = "increase",
        _object = "attack_power",
        _how_attribute = 3,
        _target = "party_all",
    },
    ["参戦者の土属性攻撃UP"] = {
        _how = "increase",
        _object = "attack_power",
        _how_attribute = 3,
        _target = "player_all",
    },
    ["風属性攻撃UP"] = {
        _how = "increase",
        _object = "attack_power",
        _how_attribute = 4,
    },
    ["参戦者の光属性攻撃UP"] = {
        _how = "increase",
        _object = "attack_power",
        _how_attribute = 5,
        _target = "player_all",
    },
    ["味方全体の闇属性攻撃UP"] = {
        _how = "increase",
        _object = "attack_power",
        _how_attribute = 6,
        _target = "party_all",
    },
    ["参戦者の防御UP"] = {
        _how = "increase",
        _object = "defense_power",
        _target = "player_all",
    },
    ["自身の攻撃大幅UP"] = {
        _how = "highly_increase_damage",
    },
    ["自分の攻撃大幅UP"] = {
        _how = "highly_increase_damage",
    },
    ["自分のHPが多いほど攻撃が大きくUP★最大HPに応じて性能上昇"] = {
        _how = "increase_damage_high_hp",
    },
    ["オーバードライブ時攻撃力UP"] = {
        _when = "overdrive_opponent",
        _how = "highly_increase_damage",
    },
    ["アビリティダメージUP"] = {
        _how = "increase",
        _object = "ability_damage",
    },
    ["味方全体の通常攻撃を全体化"] = {
        _how = "attack_all_party",
    },
    ["味方全体の通常攻撃を確率で全体化"] = {
        _how = "attack_all_chance_party",
    },
 --Defense
    ["防御UP"] = {
        _how = "increase",
        _object = "defense_power",
    },
    ["^被ダメージカット"] = {
        _how = "damage_cut",
    },
    ["^味方全体の被ダメージカット"] = {
        _how = "damage_cut",
        _target = "party_all",
    },
    ["発動ターン中味方全体の被ダメージカット"] = {
        _when = "use_turn",
        _how = "damage_cut",
        _target = "party_all",
    },
    ["火属性耐性UP"] = {
        _how = "increase",
        _object = "resist",
        _how_attribute = 1,
    },
    ["水属性耐性UP"] = {
        _how = "increase",
        _object = "resist",
        _how_attribute = 2,
    },
    ["土属性耐性UP"] = {
        _how = "increase",
        _object = "resist",
        _how_attribute = 3,
    },
    ["風属性耐性"] = {
        _object = "resist",
        _how_attribute = 4,
    },
    ["風属性耐性UP"] = {
        _how = "increase",
        _object = "resist",
        _how_attribute = 4,
    },
    ["光属性耐性UP"] = {
        _how = "increase",
        _object = "resist",
        _how_attribute = 5,
    },
    ["光耐性アップ"] = {
        _how = "increase",
        _object = "resist",
        _how_attribute = 5,
    },
    ["闇属性耐性UP"] = {
        _how = "increase",
        _object = "resist",
        _how_attribute = 6,
    },
    ["味方全体の光属性耐性UP"] = {
        _how = "increase",
        _object = "resist",
        _how_attribute = 5,
        _target = "party_all",
    },
    ["味方全体の火属性ダメージ軽減"] = {
        _how = "decrease",
        _object = "damage",
        _how_attribute = 1,
        _target = "party_all",
    },
    ["味方全体の風属性ダメージ軽減"] = {
        _how = "decrease",
        _object = "damage",
        _how_attribute = 4,
        _target = "party_all",
    },
    ["^弱体効果無効"] = {
        _how = "protect",
        _object = "debuff",
    },
    ["味方全体弱体効果無効"] = {
        _how = "protect",
        _object = "debuff",
        _target = "party_all",
    },
    ["^バリア効果"] = {
        _how = "barrier",
    },
    ["味方全体にバリア効果"] = {
        _how = "barrier",
        _target = "party_all",
    },
    ["^反射$"] = {
        _how = "reflect",
    },
    ["^ダメージ反射$"] = {
        _how = "reflect",
        _object = "damage",
    },
    ["ダメージ反射効果"] = {
        _how = "get",
        _object = "reflect_effect",
    },
 --Serial Attack
    ["自分のダブルアタック率UP"] = {
        _how = "increase",
        _object = "double_chance",
        _target = "self",
    },
    ["ダブルアタック確率UP"] = {
        _how = "increase",
        _object = "double_chance",
    },
    ["トリプルアタック確率UP"] = {
        _how = "increase",
        _object = "triple_chance",
    },
    ["トリプルアタック確率アップ"] = {
        _how = "increase",
        _object = "triple_chance",
    },
    ["効果中必ずトリプルアタック"] = {
        _when = "effect",
        _object = "triple_sure",
    },
    ["味方全体の連続攻撃確率UP"] = {
        _how = "increase",
        _object = "double_triple_chance",
    },
    ["効果中必ず連続攻撃"] = {
        _when = "effect",
        _object = "double_triple_sure",
    },
 --Critical
    ["クリティカル確率UP"] = {
        _how = "increase",
        _object = "critical_chance",
    },
 --Ougi Gauge
    ["奥義ゲージUP"] = {
        _how = "increase",
        _object = "gauge",
    },
    ["奥義ゲージ上昇量ランダムUP"] = {
        _how = "increase_random",
        _object = "gauge_store",
    },
    ["モードゲージ減少量UP"] = {
        _how = "increase",
        _object = "gauge_decrease_amount",
    },
    ["敵の全ての攻撃を回避"] = {
        _how = "evade",
        _object = "attack_all",
        _from = "opponent",
    },
    ["カウンタ"] = {
        _how = "counter",
    },
    ["敵の通常攻撃を回避して反撃"] = {
        _how = "counter",
    },
    ["敵の攻撃終了後幻影"] = {
        _how = "create",
        _object = "illusion",
        _when = "after_attacked",
    },

--Debuff
    ["攻撃DOWN"] = {
        _how = "decrease",
        _object = "attack_power",
    },
    ["攻撃力DOWN"] = {
        _how = "decrease",
        _object = "attack_power",
    },
    ["防御DOWN"] = {
        _how = "decrease",
        _object = "defense_power",
    },
    ["防御力DOWN"] = {
        _how = "decrease",
        _object = "defense_power",
    },
    ["攻防DOWN"] = {
        _how = "decrease",
        _object = "attack_defense_power",
    },
    ["水属性耐性DOWN"] = {
        _how = "decrease",
        _object = "resist",
        _how_attribute = 2,
    },
    ["土属性耐性DOWN"] = {
        _how = "decrease",
        _object = "resist",
        _how_attribute = 3,
    },
    ["土属性軽減"] = {
        _how = "decrease",
        _how_attribute = 3,
    },
    ["風属性軽減"] = {
        _how = "decrease",
        _how_attribute = 4,
    },
    ["光属性軽減"] = {
        _how = "decrease",
        _how_attribute = 5,
    },
    ["ダブルアタック確率DOWN"] = {
        _how = "decrease",
        _object = "double_chance",
    },
    ["連続攻撃確率DOWN"] = {
        _how = "decrease",
        _object = "double_triple_chance",
    },
    ["トレジャーハント効果"] = {
        _how = "treasure_hunt"
    },
    ["暗闇$"] = {
        _how = "effect",
        _abnormal = "blind",
    },
    ["暗闇効果"] = {
        _how = "effect",
        _abnormal = "blind",
    },
    ["魅了効果"] = {
        _how = "effect",
        _abnormal = "charm",
    },
    ["睡眠効果"] = {
        _how = "effect",
        _abnormal = "sleep",
    },
    ["毒効果"] = {
        _how = "effect",
        _abnormal = "poison",
    },
    ["敵の強化効果を1つ無効化し、その効果に応じた強化効果を得る"] = {
        _how = "steal_buff",
        _target = "self",
    },
    ["弱体耐性DOWN"] = {
        _how = "decrease",
        _object = "abnormal_resist",
    },
    ["オーバードライブ短縮"] = {
        _how = "decrease",
        _object = "overdrive_gauge",
    },
    ["敵の最大チャージターン増加"] = {
        _how = "increase",
        _object = "max_charge_turn",
    },
    ["稀に光と闇属性耐性UP消去"] = {
        _when = "rarely",
        _how = "erase_increase",
        _object = "resist",
        _how_attribute = 56,
    },
    ["稀に強化効果消去"] = {
        _when = "rarely",
        _how = "delete",
        _object = "buff",
    },
    ["敵のブレイク状態を維持"] = {
        _how = "prolong",
        _object = "break_time",
    },
    
 --Etc
    ["アビリティ再使用間隔をランダムでひとつ1ターン短縮"] = {
        _how = "decrease_random",
        _object = "ability_cooldown_1",
    },
    ["剣気回復"] = {
        _how = "increase",
        _object = "sword_gauge",
    },
    ["モードゲージ減少"] = {
        _how = "decrease",
        _object = "gauge",
    },
    ["敵のモードゲージを吸収して自分の奥義ゲージに変換"] = {
        _how = "absorb_gauge",
    }
}

local _amount = {
    ["小"] = {
        _size = 1,
    },
    ["中"] = {
        _size = 2,
    },
    ["大"] = {
        _size = 3,
    },
    ["特大"] = {
        _size = 4,
    },
    ["累積"] = {
        _accumulate = true,
    },
    ["^1回"] = {
        _amount = 1,
        _amount_unit = "time",
    },
    ["2回"] = {
        _amount = 2,
        _amount_unit = "time",
    },
    ["3回"] = {
        _amount = 3,
        _amount_unit = "time",
    },
    ["1回/3倍"] = {
        _extra = " (1 ครั้ง / 3 เท่า)",
    },
    ["各1ターン"] = {
        _amount = " อย่างละ 1",
        _amount_unit = "turn",
    },
    ["2ターン"] = {
        _amount = 2,
        _amount_unit = "turn",
    },
    ["2ターン"] = {
        _amount = 2,
        _amount_unit = "turn",
    },
    ["3ターン"] = {
        _amount = 3,
        _amount_unit = "turn",
    },
    ["10秒"] = {
        _amount = 10,
        _amount_unit = "second",
    },
    ["180秒"] = {
        _amount = 180,
        _amount_unit = "second",
    },
    ["3倍"] = {
        _amount = 3,
        _amount_unit = "fold",
    },
    ["20%"] = {
        _extra = " (20%)",
    },
    ["%(20%%%)"] = {
        _extra = " (20%)",
    },
    ["%(25%%%)"] = {
        _extra = " (25%)",
    },
    ["%(30%%)"] = {
        _extra = " (30%)",
    },
    ["35%"] = {
        _extra = " (35%)",
    },
    ["+3%)$"] = {
        _extra = " (+3)",
    },
    ["%(30%%%)"] = {
        _extra = " (30%)",
    },
    ["%(300"] = {
        _extra = " (300)",
    },
    ["上限300"] = {
        _extra = " (สูงสุด 300)",
    },

    ["火属性"] = {
        --_how_attribute = 1,
        _extra = " (ธาตุไฟ)",
    },
    ["水属性"] = {
        --_how_attribute = 2,
        _extra = " (ธาตุน้ำ)",
    },
    ["土属性"] = {
        --_how_attribute = 3,
        _extra = " (ธาตุดิน)",
    },
    ["風属性"] = {
        --_how_attribute = 4,
        _extra = " (ธาตุลม)",
    },
    ["光属性"] = {
        --_how_attribute = 5,
        _extra = " (ธาตุแสง)",
    },
    ["闇属性"] = {
        --_how_attribute = 6,
        _extra = " (ธาตุมืด)",
    },

    ["%(ブレイク時のみ/1回"] = {
        _extra = " (เฉพาะตอนเบรค / 1 ครั้ง)",
    },
    ["敵ブレイク時のみ/1回"] = {
        _extra = " (เฉพาะตอนศัตรูเบรค / 1 ครั้ง)",
    },
    ["敵オーバードライブ時のみ/1回"] = {
        _extra = " (เฉพาะตอนศัตรู overdrive / 1 ครั้ง)",
    },
}

function TranslateEffect.translate(str)
    local effect = {}
    
    local bracketRegEx = '%(.*%)';
    local bracket = mw.ustring.match(str, bracketRegEx)
    local no_bracket = mw.ustring.gsub(str, bracketRegEx, "")
    
    effect = TranslateEffect.find_word(no_bracket, _all)
    
    if bracket and effect then
        amount_word = TranslateEffect.find_word(bracket, _amount)
        if amount_word then
            effect = TranslateEffect.combine_tables(effect, amount_word)
        end
    end
    
    --effect = TranslateEffect.check_word(effect, no_bracket)
    --effect = TranslateEffect.text(effect)
    if effect then
        return effect
    else
        return {_how = str}
    end
end

function TranslateEffect.text(word)
    local tmp = ""
    for i, txt in pairs(word) do
        tmp = tmp..'||-|| '..i..'||'..txt
    end
    word._extra = tmp
    return word
end

function TranslateEffect.check_word(word, str)
    if word._extra == " (30%)" then
        word._extra = '||'..str
    else
        word._extra = '||'..word._extra
    end
    return word
end

function TranslateEffect.find_word(str, key)
    for jp, en in pairs(key) do
        if mw.ustring.match(str, jp) then
            return en
        end
    end
    return nil
end

function TranslateEffect.combine_tables(table1, table2)
    for k,v in pairs(table2) do 
        table1[k] = v 
    end
    return table1
end

return TranslateEffect
Advertisement