#============================================================================== # RGSS2_SRPG2拡張 二刀流で2回攻撃 # 2011/12/16公開 # C Winter (http://ccwinter.blog.fc2.com/) #============================================================================== #============================================================================== # ■ Window_Status #============================================================================== class Window_Status < Window_Base #-------------------------------------------------------------------------- # ● 能力値の描画 #-------------------------------------------------------------------------- alias two_sword_draw_actor_parameter draw_actor_parameter def draw_actor_parameter(actor, x, y, type) if type == 0 and actor.two_swords_style v1 = actor.atk v2 = actor.atk_two_sword(0) v3 = actor.atk_two_sword(1) case TSRPG::STATUS_SHOW_MODE when 1 self.contents.font.color = system_color self.contents.draw_text(x, y - 24, 64, WLH, "片手") self.contents.font.color = normal_color if actor.hand_two_swords? self.contents.draw_text(x + 56, y - 24, 116, WLH, sprintf("(%d+%d)", v2, v3)) end when 2 self.contents.font.color = system_color self.contents.draw_text(x, y - 24, 64, WLH, "片手") self.contents.font.color = normal_color if actor.hand_two_swords? self.contents.draw_text(x + 64, y - 24, 52, WLH, v2, 2) self.contents.draw_text(x + 116, y - 24, 60, WLH, "+") self.contents.draw_text(x + 126, y - 24, 104, WLH, v3) end when 3 if actor.hand_two_swords? self.contents.draw_text(x, y - 24, 116, WLH, sprintf("(%d + %d)", v2, v3), 2) end end self.contents.draw_text(x + 120, y - 24, 36, WLH, v1, 2) unless actor.hand_two_swords? end two_sword_draw_actor_parameter(actor, x, y, type) end end #============================================================================== # ■ Window_Info #============================================================================== class Window_Info < Window_Base #-------------------------------------------------------------------------- # ● 能力値の描画 #-------------------------------------------------------------------------- alias two_sword_draw_actor_parameter draw_actor_parameter def draw_actor_parameter(actor, x, y, type) if type == 0 and actor.two_swords_style v1 = actor.atk v2 = actor.atk_two_sword(0) v3 = actor.atk_two_sword(1) case TSRPG::STATUS_SHOW_MODE when 1 self.contents.font.color = system_color self.contents.draw_text(x, y - 24, 64, WLH, "片手") self.contents.font.color = normal_color if actor.hand_two_swords? self.contents.draw_text(x + 56, y - 24, 116, WLH, sprintf("(%d+%d)", v2, v3)) end when 2 self.contents.font.color = system_color self.contents.draw_text(x, y - 24, 64, WLH, "片手") self.contents.font.color = normal_color if actor.hand_two_swords? self.contents.draw_text(x + 64, y - 24, 52, WLH, v2, 2) self.contents.draw_text(x + 116, y - 24, 60, WLH, "+") self.contents.draw_text(x + 126, y - 24, 104, WLH, v3) end when 3 if actor.hand_two_swords? self.contents.draw_text(x, y - 24, 116, WLH, sprintf("(%d + %d)", v2, v3), 2) end end self.contents.draw_text(x + 64, y - 24, 52, WLH, v1, 2) unless actor.hand_two_swords? end two_sword_draw_actor_parameter(actor, x, y, type) end end #============================================================================== # ■ Game_Battler #============================================================================== class Game_Battler #-------------------------------------------------------------------------- # ● 通常攻撃によるダメージ(分散値を除外)予測値を返す #-------------------------------------------------------------------------- def get_attack_damage_two_sword(type, attacker) damage = attacker.atk_two_sword(type) * 4 - self.def * 2 # 基本計算 if $game_temp.unit_back_attack # 背後攻撃ボーナス damage += damage * TSRPG::BACK_ATTACK_BONUS / 100 end damage /= 2 if attacker.mp < attacker.atk_mp_cost_two_sword(type) # MP不足ならダメージ半減 damage = 0 if damage < 0 # マイナスなら 0 に damage *= elements_max_rate(attacker.element_set) # 属性修正 damage /= 100 damage = apply_guard(damage) # 防御修正 return damage end end #============================================================================== # ■ Window_Status_Srpg #============================================================================== class Window_Status_Srpg < Window_Base #-------------------------------------------------------------------------- # ● 命中率(回避率含む)を返す #-------------------------------------------------------------------------- def get_hit_rate_two_sword(type) hit = @target.unit.calc_hit_two_sword(type, @attacker.unit, @obj) hit = hit * (100 - @target.unit.calc_eva(@attacker.unit, @obj)) / 100 return hit end #-------------------------------------------------------------------------- # ● リフレッシュ #update1.011 #-------------------------------------------------------------------------- def refresh(attacker, target = nil) self.contents.clear # 描画対象がいなければ地形効果だけを描画 if attacker == nil self.contents.draw_text(0, 0, 240, WLH, make_text_tile(@cx, @cy)) @back_sprite.visible = false return end self.contents.font.color.alpha = 128 if attacker.unit.float? self.contents.draw_text(0, 0, 240, WLH, make_text_tile(attacker.x, attacker.y)) self.contents.font.color.alpha = 255 draw_face(attacker.face_name, attacker.face_index, 0, WLH * 1) self.contents.draw_text(0, WLH * 1, 96, WLH, attacker.unit.name) draw_actor_state(attacker.unit, 96, WLH * 2, 120) draw_actor_hp(attacker.unit, 96, WLH * 3) draw_actor_mp(attacker.unit, 96, WLH * 4) if target != nil attacker.back_attack?(target) # 背後を取っているかチェック @attacker = attacker @target = target # ターゲットステータス self.contents.font.color.alpha = 128 if target.unit.float? self.contents.draw_text(272, 0, 240, WLH, make_text_tile(target.x, target.y), 2) self.contents.font.color.alpha = 255 draw_face(target.face_name, target.face_index, 406, WLH * 1) self.contents.draw_text(406, WLH * 4, 96, WLH, target.unit.name, 2) draw_actor_hp(target.unit, 286, WLH * 1) draw_actor_mp(target.unit, 286, WLH * 2) draw_actor_state(target.unit, 286, WLH * 3, 120) # 行動結果予測 self.contents.draw_text(240, WLH * 3 - 12, 32, WLH, ">", 1) # 通常攻撃 if attacker.unit.action.attack? @obj = nil @damage = target.unit.get_attack_damage(attacker.unit) text = sprintf("%+d (%d%%)", (0 - @damage), get_hit_rate) n = $scene.get_counter_rate(attacker, target) if n > 0 self.contents.draw_text(230, WLH * 4, 168, WLH, sprintf("反撃 %d%", n), 2) end if attacker.unit.two_swords_style and attacker.unit.hand_two_swords? damage1 = target.unit.get_attack_damage_two_sword(0, attacker.unit) damage2 = target.unit.get_attack_damage_two_sword(1, attacker.unit) hit1 = get_hit_rate_two_sword(0) hit2 = get_hit_rate_two_sword(1) text = sprintf("%+d(%d%%)%+d(%d%%)", (0 - damage1), hit1, (0 - damage2), hit2) self.contents.draw_text(96, WLH * 1, 200, WLH, text) @back_sprite.visible = true self.visible = true return end # スキル elsif attacker.unit.action.skill? @obj = attacker.unit.action.skill @damage = target.unit.get_obj_damage(attacker.unit, @obj) text = make_text_obj(@obj.damage_to_mp) # アイテム elsif attacker.unit.action.item? @obj = attacker.unit.action.item hp_recovery = target.unit.calc_hp_recovery(attacker.unit, @obj) # HP 回復量計算 mp_recovery = target.unit.calc_mp_recovery(attacker.unit, @obj) # MP 回復量計算 @damage = target.unit.get_obj_damage(attacker.unit, @obj) if target.unit.zombie? # ゾンビ状態の回復量反転 hp_recovery = 0 - hp_recovery mp_recovery = 0 - mp_recovery end @damage -= hp_recovery # HP 回復量を差し引く if @obj.damage_to_mp or (@damage == 0 and mp_recovery != 0) @damage -= mp_recovery # MP 回復量を差し引く text = make_text_obj(true) else text = make_text_obj(false) end end self.contents.draw_text(112, WLH * 1, 176, WLH, text) @back_sprite.visible = true else @back_sprite.visible = false end self.visible = true end end #============================================================================== # ■ Window_ShopStatus #============================================================================== class Window_ShopStatus < Window_Base #-------------------------------------------------------------------------- # ● アクターの現装備と能力値変化の描画 # actor : アクター # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_actor_parameter_change(actor, x, y) return if @item.is_a?(RPG::Item) y = WLH * (actor.index + 2) enabled = actor.equippable?(@item) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(x + 24, y, 176, WLH, actor.name) if @item.is_a?(RPG::Weapon) item1 = weaker_weapon(actor) elsif actor.two_swords_style and @item.kind == 0 item1 = nil else item1 = actor.equips[1 + @item.kind] end if enabled if @item.is_a?(RPG::Weapon) if actor.two_swords_style and TSRPG::SHOP_SHOW_MODE == 1 item1 = actor.weapons[0] item2 = actor.weapons[1] atk1 = item1 == nil ? 0 : item1.atk atk2 = item2 == nil ? 0 : item2.atk atk3 = @item == nil ? 0 : @item.atk change1 = atk3 - atk1 change2 = atk3 - atk2 draw_icon(item1.icon_index, x + 92, y, enabled) if item1 != nil self.contents.draw_text(x, y, 148, WLH, sprintf("%+d", change1), 2) draw_icon(item2.icon_index, x + 144, y, enabled) if item2 != nil self.contents.draw_text(x, y, 200, WLH, sprintf("%+d", change2), 2) return else atk1 = item1 == nil ? 0 : item1.atk atk2 = @item == nil ? 0 : @item.atk change = atk2 - atk1 end else def1 = item1 == nil ? 0 : item1.def def2 = @item == nil ? 0 : @item.def change = def2 - def1 end self.contents.draw_text(x, y, 200, WLH, sprintf("%+d", change), 2) end draw_icon(item1.icon_index, x, y, enabled) if item1 != nil end end #============================================================================== # ■ Scene_Equip #============================================================================== class Scene_Equip < Scene_Base #-------------------------------------------------------------------------- # ● ステータスウィンドウの更新 #-------------------------------------------------------------------------- def update_status_window if @equip_window.active @status_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil, nil, nil) elsif @item_window.active temp_actor = @actor.clone temp_actor.change_equip(@equip_window.index, @item_window.item, true) new_atk = temp_actor.atk new_def = temp_actor.def new_spi = temp_actor.spi new_agi = temp_actor.agi new_counter = temp_actor.counter_power new_coop = temp_actor.coop_power new_hit = temp_actor.hit new_eva = temp_actor.eva new_cri = temp_actor.cri new_weight = temp_actor.weight @status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi, new_counter, new_coop, new_hit, new_eva, new_cri, new_weight) end @status_window.update end end #============================================================================== # ■ Window_EquipStatus #============================================================================== class Window_EquipStatus < Window_Base #-------------------------------------------------------------------------- # ● 能力値の描画 # x : 描画先 X 座標 # y : 描画先 Y 座標 # type : 能力値の種類 (0〜3) #-------------------------------------------------------------------------- alias two_sword_draw_parameter draw_parameter def draw_parameter(x, y, type) if type == 0 and @actor.two_swords_style and TSRPG::EQUIP_SHOW_MODE self.contents.draw_text(x + 90, y - 24, 30, WLH, @actor.atk_two_sword(0), 2) self.contents.draw_text(x + 142, y - 24, 30, WLH, @actor.atk_two_sword(1), 2) end two_sword_draw_parameter(x, y, type) end end