Skip to content
This repository has been archived by the owner on Jan 20, 2020. It is now read-only.

Commit

Permalink
武器の+数値を追加/コスモス武器をスキル枠に含めた
Browse files Browse the repository at this point in the history
  • Loading branch information
hibinonaoki committed Nov 14, 2016
1 parent 62cb998 commit e78c028
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 32 deletions.
4 changes: 4 additions & 0 deletions css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
composes: number;
}

.plus {
width: 2.5em;
}

.name {
width: 10em;
}
Expand Down
3 changes: 2 additions & 1 deletion css/weapon.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
composes: input;
}

.cosmos {
.plus {
composes: plus from "./app.css";
composes: input;
}

Expand Down
6 changes: 3 additions & 3 deletions js/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,10 @@ export function set_weapon_skill_lv(index, lv) {
};
}

// cosmosを(booleanで)セットする
export function set_weapon_cosmos(index, value) {
// 武器の+数値をセットする
export function set_weapon_plus(index, value) {
return function (dispatch) {
dispatch({ type: RC.weapon.COSMOS, index: Number(index), value: Boolean(value) });
dispatch({ type: RC.weapon.PLUS, index: Number(index), value: Number(value) });
return true;
};
}
Expand Down
8 changes: 4 additions & 4 deletions js/atk_calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
weapon: [ // 武器1つを配列の要素1つで表わす
{
atk: 武器攻撃力(Number),
plus: 武器の+数値(Number),
type: 武器の種類を表わした文字列(String),
skill_level: 武器のスキルレベル(Number),
skill_slot: [武器のスキル1つ目の枠名の文字列(String), 同2つ目 ],
skill_type: [武器のスキル1つ目の種別の文字列(String), 同2つ目 ],
cosmos: コスモス武器か否か(boolean)
}, ...
],
summon: [ // 召喚1つを配列の(ry 最初のものがメイン召喚石として計算される
Expand Down Expand Up @@ -119,7 +119,7 @@ export default function calculate_atkval (param_obj, job_data) {
// 一番最初のコスモス武器が該当
let cosmos_weapon_type = "no_cosmos"; // "none"では該当が出てきてしまう
for (let i = 0; i < param_obj.weapon.length; i++) {
if (param_obj.weapon[i].cosmos) {
if (param_obj.weapon[i].skill_slot[0] == "cosmos" || param_obj.weapon[i].skill_slot[1] == "cosmos") {
cosmos_weapon_type = param_obj.weapon[i].type;
break;
}
Expand All @@ -130,7 +130,7 @@ export default function calculate_atkval (param_obj, job_data) {
let total_atk = 0;
const zenith_bonus = [0, 1, 3, 5, 6, 8, 10]; // 各zenithの星に対応する追加ボーナス%
param_obj.weapon.forEach(function(weapon) {
let atk = weapon.atk; // 基礎攻撃力
let atk = weapon.atk + weapon.plus * 5; // 基礎攻撃力
let specialty_basic = 100; // 得意武器倍率%
let specialty_bonus = 0; // Zenith追加%
let job = job_data[param_obj.job]; // 該当ジョブのデータを取得
Expand All @@ -147,7 +147,7 @@ export default function calculate_atkval (param_obj, job_data) {
}
let specialty_cosmos = (weapon.type == cosmos_weapon_type) ? 30 : 0; // コスモス該当武器の追加%
// 自身がコスモス武器なら自身の倍率は0
if (weapon.cosmos) {
if (weapon.skill_slot[0] == "cosmos") {
specialty_cosmos = 0;
}
// 武器攻撃力に倍率をかける
Expand Down
2 changes: 1 addition & 1 deletion js/const/reducer_type.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const weapon = {
MOVE: "WEAPON_MOVE",
ENABLE: "WEAPON_ENABLE",
DISABLE: "WEAPON_DISABLE",
COSMOS: "WEAPON_SET_COSMOS_STATUS",
PLUS: "WEAPON_SET_PLUS",
LOCK: "WEAPON_SET_LOCK_STATUS",
NAME: "WEAPON_SET_NAME",
ATK: "WEAPON_SET_ATK",
Expand Down
4 changes: 0 additions & 4 deletions js/const/weapon_list_ja.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ const WEAPON_LIST = [ // 配列で表記する
skill: ["kj1"], // スキル名(内部表記-ここでは攻刃小)
atk: 2580, // 最大攻撃力(この数値が自動的に入力される)
type: "sword", // 武器種別の内部表記
cosmos: false // この武器がコスモス武器か否か
},
{
name: "[吸血剣]ダーインスレイブ",
skill: ["kj1"],
atk: 3010,
type: "sword",
cosmos: false
}
]
},
Expand All @@ -33,14 +31,12 @@ const WEAPON_LIST = [ // 配列で表記する
skill: ["kj1"],
atk: 2240,
type: "spear",
cosmos: false
},
{
name: "[烈伐]ピラム",
skill: ["kj1"],
atk: 2610,
type: "spear",
cosmos: false
}
]
}
Expand Down
5 changes: 3 additions & 2 deletions js/locale/ja.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let text = {
lock: "鍵",
name: "名前",
value: "攻撃力",
cosmos: "",
plus: "",
type: "種別",
skill1: "スキル1",
skill2: "スキル2",
Expand All @@ -47,7 +47,8 @@ let text = {
magna: "方陣",
ex: "EX",
unknown: "アンノウン",
baha: "バハ"
baha: "バハ",
cosmos: "コスモス"
},
skill: {
none: "無し",
Expand Down
7 changes: 3 additions & 4 deletions js/reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const weapon_default = {
skill_level: 0,
skill_slot: ["normal", "normal"],
skill_type: ["none", "none"],
cosmos: false,
plus: 0,
selected: false,
locked: false,
type: "sword",
Expand Down Expand Up @@ -72,9 +72,8 @@ export function weapon(state, action) {
} else if (action.type == RC.weapon.APPEND && state.length < WEAPON_MAX) { // 武器の追加
let insert_state = Object.assign({}, weapon_default);
ret_state.splice(action.index+1, 0, insert_state);
} else if (action.type == RC.weapon.COSMOS) { // 武器コスモス属性の設定
let cosmos = action.value ? action.value : false;
ret_state[action.index] = Object.assign({}, ret_state[action.index], { cosmos: cosmos });
} else if (action.type == RC.weapon.PLUS) { // 武器の+数値設定
ret_state[action.index].plus = Number(action.value);
} else if (action.type == RC.weapon.LOCK) { // 武器のロック設定
let value = action.value ? action.value : false;
ret_state[action.index] = Object.assign({}, ret_state[action.index], { locked: value });
Expand Down
28 changes: 15 additions & 13 deletions js/weapon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
move_weapon_object,
insert_weapon_object,
delete_weapon_object,
set_weapon_cosmos,
set_weapon_plus,
set_weapon_lock,
set_weapon_name,
set_weapon_type,
Expand Down Expand Up @@ -73,7 +73,7 @@ class WeaponTableHeader extends Component {
<Translate component="th" content={ t_header+"lock" } />
<Translate component="th" content={ t_header+"name" } />
<Translate component="th" content={ t_header+"value" } />
<Translate component="th" content={ t_header+"cosmos" } />
<Translate component="th" content={ t_header+"plus" } />
<Translate component="th" content={ t_header+"type" } />
<Translate component="th" content={ t_header+"skill1" } colSpan="2" />
<Translate component="th" content={ t_header+"skill2" } colSpan="2" />
Expand Down Expand Up @@ -177,9 +177,9 @@ function mapStateToWeaponRowProps(state, props) {
let skill_level = (target_state.skill_level === undefined) ? 0 : target_state.skill_level;
let skill_slot = (target_state.skill_slot === undefined) ? ["normal", "normal"] : target_state.skill_slot;
let skill_type = (target_state.skill_type === undefined) ? ["none", "none"] : target_state.skill_type;
let cosmos = (target_state.cosmos === undefined) ? false : target_state.cosmos;
let plus = (target_state.plus === undefined) ? false : target_state.plus;
let type = (target_state.type === undefined) ? "sword" : target_state.type;
return { selected, name, atk, skill_level, skill_slot, skill_type, cosmos, type, locked };
return { selected, name, atk, skill_level, skill_slot, skill_type, plus, type, locked };
}
// reduxのaction creatorをpropsに注入するためのobject
var mapActionCreatorsToWeaponRowProps = {
Expand All @@ -189,7 +189,7 @@ var mapActionCreatorsToWeaponRowProps = {
insert_weapon_object,
delete_weapon_object,
set_weapon_name,
set_weapon_cosmos,
set_weapon_plus,
set_weapon_lock,
set_weapon_atk_value,
set_weapon_type,
Expand Down Expand Up @@ -217,7 +217,8 @@ export const SKILL_SLOT = [
["magna"],
["ex"],
["unknown"],
["baha"]
["baha"],
["cosmos"]
];

// スキル種別は、スキルスロットによって変わる
Expand Down Expand Up @@ -263,7 +264,8 @@ export const SKILL_TYPE_BAHA = [
];

export const SKILL_TYPE_COSMOS = [
["none"]
["at"],
["etc"]
];

const SKILL_LV = [
Expand Down Expand Up @@ -360,9 +362,9 @@ class WeaponRow extends Component {
this.props.insert_weapon_object(this.props.index);
}

// コスモスの変化
change_cosmos(e) {
this.props.set_weapon_cosmos(this.props.index, e.target.checked);
// +数値の変化
change_plus(e) {
this.props.set_weapon_plus(this.props.index, e.target.value);
}

// 鍵チェックボックスの変化
Expand All @@ -377,7 +379,7 @@ class WeaponRow extends Component {
this.change_locked = ::this.change_locked;
this.change_name = ::this.change_name;
this.change_atk = ::this.change_atk;
this.change_cosmos = ::this.change_cosmos;
this.change_plus = ::this.change_plus;
this.change_kind = ::this.change_kind;
this.change_skill_slot1 = ::this.change_skill_slot1;
this.change_skill_type1 = ::this.change_skill_type1;
Expand All @@ -393,7 +395,7 @@ class WeaponRow extends Component {
render() {
// 必要な要素をpropsから変数に取りだす
const { isDragging, isOver, connectDragSource, connectDragPreview, connectDropTarget, index, inputlock } = this.props;
const { selected, name, atk, skill_level, skill_slot, skill_type, cosmos, type, locked, first_selected } = this.props;
const { selected, name, atk, skill_level, skill_slot, skill_type, plus, type, locked, first_selected } = this.props;
// つかむところに適用されるスタイルを作る
let style_hundle = "hundle";
style_hundle = isOver ? "hundle_on_over" : style_hundle;
Expand All @@ -418,7 +420,7 @@ class WeaponRow extends Component {
<input type="number" styleName="atk" value={atk} onChange={this.change_atk} disabled={inputlock} />
</td>
<td>
<input type="checkbox" styleName="cosmos" checked={cosmos} onChange={this.change_cosmos} disabled={inputlock} />
<input type="number" styleName="plus" value={plus} onChange={this.change_plus} disabled={inputlock} />
</td>
<td>
<select styleName="kind" value={type} onChange={this.change_kind} disabled={inputlock} >
Expand Down

0 comments on commit e78c028

Please sign in to comment.