524 lines
No EOL
17 KiB
JavaScript
524 lines
No EOL
17 KiB
JavaScript
StateControl.arrangeState = function(unit, state, increaseType) {
|
|
var turnState;
|
|
var list = unit.getTurnStateList();
|
|
var count = list.getCount();
|
|
var editor = root.getDataEditor();
|
|
|
|
if (increaseType === IncreaseType.INCREASE) {
|
|
var downStateList = [6, 7, 8];
|
|
if (state.getId() === 6) {
|
|
if (isEro()) {
|
|
return;
|
|
}
|
|
|
|
for (var i = 0; i < downStateList.length; i++) {
|
|
var id = downStateList[i];
|
|
var beforeState = this._getState(id);
|
|
turnState = this.getTurnState(unit, beforeState);
|
|
if (turnState !== null) {
|
|
if (i < downStateList.length - 1) {
|
|
editor.deleteTurnStateData(list, beforeState);
|
|
var newState = this._getState(downStateList[i + 1]);
|
|
editor.addTurnStateData(list, newState);
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
if (state.getId() === 15) {
|
|
// 盗み
|
|
if (unit.getUnitType() === UnitType.PLAYER) {
|
|
// 効果なし
|
|
return;
|
|
}
|
|
steal(unit);
|
|
return;
|
|
}
|
|
if (state.getId() === 14) {
|
|
// 裸
|
|
root.getCurrentSession().getCurrentMapInfo().getLocalSwitchTable().setSwitch(11, true);
|
|
return;
|
|
}
|
|
|
|
if (state.getId() === 10) {
|
|
// 中だし
|
|
root.getCurrentSession().getCurrentMapInfo().getLocalSwitchTable().setSwitch(5, true);
|
|
root.getCurrentSession().getCurrentMapInfo().getLocalSwitchTable().setSwitch(6, false);
|
|
nakadashi(randomBetween(1, 4));
|
|
return;
|
|
}
|
|
if (state.getId() === 11) {
|
|
// アナル
|
|
root.getCurrentSession().getCurrentMapInfo().getLocalSwitchTable().setSwitch(5, false);
|
|
root.getCurrentSession().getCurrentMapInfo().getLocalSwitchTable().setSwitch(6, true);
|
|
anal();
|
|
return;
|
|
}
|
|
if (state.getId() === 21) {
|
|
// 中出しかアナル
|
|
var analRate = 30;
|
|
if (root.getCurrentSession().getCurrentMapInfo().getLocalSwitchTable().isSwitchOn(6)) {
|
|
analRate = 70;
|
|
}
|
|
if (Math.random() * 100 < analRate) {
|
|
anal();
|
|
}
|
|
nakadashi(randomBetween(1, 4));
|
|
|
|
return;
|
|
}
|
|
if (state.getId() === 19) {
|
|
// チート中だし
|
|
nakadashi(randomBetween(3, 10));
|
|
return;
|
|
}
|
|
function nakadashi(plus) {
|
|
var val = getNameByVal2(unit.getName());
|
|
if (val > 0) {
|
|
// 中出し増加
|
|
root.log('中出し増加');
|
|
var valId = val * 10 + 6;
|
|
var value = root.getMetaSession().getVariableTable(0).getVariable(valId);
|
|
root.getMetaSession().getVariableTable(0).setVariable(valId, value + 1);
|
|
plusEroTotal(val, 1);
|
|
checkNinshin(val, plus);
|
|
}
|
|
}
|
|
function anal() {
|
|
var val = getNameByVal2(unit.getName());
|
|
if (val > 0) {
|
|
// アナル増加
|
|
root.log('アナル増加');
|
|
|
|
var valId = val * 10 + 8;
|
|
var value = root.getMetaSession().getVariableTable(0).getVariable(valId);
|
|
root.getMetaSession().getVariableTable(0).setVariable(valId, value + 1);
|
|
plusEroTotal(val, 1);
|
|
}
|
|
}
|
|
|
|
if (state.getId() === 12) {
|
|
// 口
|
|
var val = getNameByVal2(unit.getName());
|
|
if (val > 0) {
|
|
var valId = val * 10 + 7;
|
|
var value = root.getMetaSession().getVariableTable(0).getVariable(valId);
|
|
root.getMetaSession().getVariableTable(0).setVariable(valId, value + 1);
|
|
plusEroTotal(val, 1);
|
|
}
|
|
return;
|
|
}
|
|
if (state.getId() === 17) {
|
|
var val = getNameByVal2(unit.getName());
|
|
if (val > 0) {
|
|
plusEroTotal(val, 1);
|
|
}
|
|
return;
|
|
}
|
|
function plusEroTotal(val, plus) {
|
|
var valId = val * 10 + 9;
|
|
var value = root.getMetaSession().getVariableTable(0).getVariable(valId);
|
|
root.getMetaSession().getVariableTable(0).setVariable(valId, value + plus);
|
|
}
|
|
|
|
turnState = this.getTurnState(unit, state);
|
|
if (turnState !== null) {
|
|
// 既にステートが追加されている場合は、ターン数値を更新する
|
|
turnState.setTurn(state.getTurn());
|
|
}
|
|
else {
|
|
if (count < DataConfig.getMaxStateCount()) {
|
|
editor.addTurnStateData(list, state);
|
|
}
|
|
}
|
|
}
|
|
else if (increaseType === IncreaseType.DECREASE) {
|
|
editor.deleteTurnStateData(list, state);
|
|
}
|
|
else if (increaseType === IncreaseType.ALLRELEASE) {
|
|
editor.deleteAllTurnStateData(list);
|
|
}
|
|
};
|
|
function checkNinshin(val, plus) {
|
|
var bote = root.getMetaSession().getGlobalSwitchTable().isSwitchOn(val * 10 + 3);
|
|
if (bote) {
|
|
return;
|
|
}
|
|
var ninshinId = val * 10 + 6;
|
|
var ninshin = root.getMetaSession().getGlobalSwitchTable().isSwitchOn(ninshinId);
|
|
if (ninshin) {
|
|
return;
|
|
}
|
|
var hinin = getEroEquipSwitchId(val, itemIdMap[34]);
|
|
if (root.getMetaSession().getGlobalSwitchTable().isSwitchOn(hinin)) {
|
|
root.log('避妊の法装備');
|
|
root.getMetaSession().getVariableTable(0).setVariable(rateId, 0);
|
|
return;
|
|
}
|
|
var rateId = val * 10 + 5;
|
|
if (root.getCurrentSession().getCurrentMapInfo().getLocalSwitchTable().isSwitchOn(12)) {
|
|
plus *= 2;
|
|
}
|
|
var value = root.getMetaSession().getVariableTable(0).getVariable(rateId) + plus;
|
|
if (value >= getNinshinMax(val)) {
|
|
root.getMetaSession().getGlobalSwitchTable().setSwitch(ninshinId, true);
|
|
var tane = 0;
|
|
var taneName = '不明';
|
|
if (root.getCurrentSession().getCurrentMapInfo().getLocalSwitchTable().isSwitchOn(1)) {
|
|
// 山賊
|
|
tane = 1;
|
|
taneName = '山賊';
|
|
}
|
|
else if (root.getCurrentSession().getCurrentMapInfo().getLocalSwitchTable().isSwitchOn(2)) {
|
|
// Giacomo
|
|
tane = 2;
|
|
taneName = 'Giacomo';
|
|
}
|
|
else if (root.getCurrentSession().getCurrentMapInfo().getLocalSwitchTable().isSwitchOn(3)) {
|
|
// Dalles
|
|
tane = 3;
|
|
taneName = 'Dalles';
|
|
}
|
|
else if (root.getCurrentSession().getCurrentMapInfo().getLocalSwitchTable().isSwitchOn(4)) {
|
|
// Villager
|
|
tane = 4;
|
|
taneName = '村人';
|
|
}
|
|
|
|
root.log('妊娠 :種親 ' + taneName);
|
|
var taneId = val * 10 + 3;
|
|
root.getMetaSession().getVariableTable(0).setVariable(taneId, tane);
|
|
|
|
root.getMetaSession().getVariableTable(0).setVariable(rateId, getNinshinMax(val));
|
|
} else {
|
|
root.getMetaSession().getVariableTable(0).setVariable(rateId, value);
|
|
}
|
|
}
|
|
function steal(unit) {
|
|
var lv = unit.getLv();
|
|
var gainGold = 100;
|
|
switch (lv) {
|
|
case 1:
|
|
case 2:
|
|
case 3:
|
|
gainGold = 40;
|
|
break;
|
|
case 4:
|
|
case 5:
|
|
gainGold = 60;
|
|
break;
|
|
case 6:
|
|
case 7:
|
|
gainGold = 80;
|
|
break;
|
|
case 8:
|
|
case 9:
|
|
gainGold = 100;
|
|
break;
|
|
case 10:
|
|
case 11:
|
|
case 12:
|
|
case 13:
|
|
gainGold = 120;
|
|
break;
|
|
case 14:
|
|
case 15:
|
|
gainGold = 150;
|
|
break;
|
|
default:
|
|
gainGold = 200;
|
|
}
|
|
root.getMetaSession().getVariableTable(1).setVariable(7, gainGold);
|
|
var gold = root.getMetaSession().getGold();
|
|
root.getMetaSession().setGold(gold + gainGold);
|
|
}
|
|
|
|
StateControl._getState = function(id) {
|
|
var list = root.getBaseData().getStateList();
|
|
return list.getDataFromId(id);
|
|
};
|
|
|
|
var AVOID_DOWN = 10;
|
|
var POW_DOWN = 10;
|
|
|
|
AbilityCalculator.getAvoid = function(unit) {
|
|
var avoid, terrain;
|
|
var cls = unit.getClass();
|
|
|
|
// 回避は、(速さ * 3)
|
|
avoid = RealBonus.getSpd(unit) * 3 + RealBonus.getLuk(unit);
|
|
|
|
// クラスタイプが地形ボーナスを考慮する場合は、「地形効果」の回避率を加算する
|
|
if (cls.getClassType().isTerrainBonusEnabled()) {
|
|
terrain = PosChecker.getTerrainFromPos(unit.getMapX(), unit.getMapY());
|
|
if (terrain !== null) {
|
|
avoid += terrain.getAvoid();
|
|
}
|
|
}
|
|
if (StateControl.getTurnState(unit, StateControl._getState(8))) {
|
|
avoid -= AVOID_DOWN * 3;
|
|
}
|
|
else if (StateControl.getTurnState(unit, StateControl._getState(7))) {
|
|
avoid -= AVOID_DOWN * 2;
|
|
}
|
|
else if (StateControl.getTurnState(unit, StateControl._getState(6))) {
|
|
avoid -= AVOID_DOWN;
|
|
}
|
|
|
|
return avoid;
|
|
};
|
|
AbilityCalculator.getPower = function(unit, weapon) {
|
|
var pow;
|
|
|
|
if (Miscellaneous.isPhysicsBattle(weapon)) {
|
|
// 物理攻撃または投射攻撃
|
|
pow = RealBonus.getStr(unit);
|
|
}
|
|
else {
|
|
// 魔法攻撃
|
|
pow = RealBonus.getMag(unit);
|
|
}
|
|
|
|
// 武器の威力 + (力 or 魔力)
|
|
pow += weapon.getPow();
|
|
|
|
if (StateControl.getTurnState(unit, StateControl._getState(8))) {
|
|
var down = Math.ceil(pow * (POW_DOWN * 3) / 100.0);
|
|
pow -= down;
|
|
}
|
|
else if (StateControl.getTurnState(unit, StateControl._getState(7))) {
|
|
var down = Math.ceil(pow * (POW_DOWN * 2) / 100.0);
|
|
pow -= down;
|
|
}
|
|
else if (StateControl.getTurnState(unit, StateControl._getState(6))) {
|
|
var down = Math.ceil(pow * (POW_DOWN * 1) / 100.0);
|
|
pow -= down;
|
|
}
|
|
|
|
return pow;
|
|
};
|
|
|
|
var _AttackFlow_moveEndFlow = AttackFlow.moveEndFlow;
|
|
AttackFlow.moveEndFlow = function() {
|
|
var result = _AttackFlow_moveEndFlow.call(this);
|
|
if (result == MoveResult.END) {
|
|
this.addAttackState();
|
|
}
|
|
|
|
return result;
|
|
};
|
|
|
|
var _AttackFlow_finalizeAttack = AttackFlow.finalizeAttack;
|
|
AttackFlow.finalizeAttack = function() {
|
|
this.addAttackState();
|
|
_AttackFlow_finalizeAttack.call(this);
|
|
};
|
|
|
|
AttackFlow.addAttackState = function() {
|
|
var order = this._order;
|
|
var active = order.getActiveUnit();
|
|
var passive = order.getPassiveUnit();
|
|
|
|
var unit;
|
|
var unit2;
|
|
var type = root.getCurrentSession().getTurnType();
|
|
if (type === TurnType.PLAYER) {
|
|
if (active.getUnitType() === UnitType.ENEMY) {
|
|
unit = active;
|
|
unit2 = passive;
|
|
} else {
|
|
unit = passive;
|
|
unit2 = active;
|
|
}
|
|
}
|
|
else if (type === TurnType.ENEMY) {
|
|
if (active.getUnitType() === UnitType.PLAYER) {
|
|
unit = active;
|
|
unit2 = passive;
|
|
} else {
|
|
unit = passive;
|
|
unit2 = active;
|
|
}
|
|
}
|
|
else {
|
|
return;
|
|
}
|
|
|
|
var state = StateControl._getState(6);
|
|
StateControl.arrangeState(unit, state, IncreaseType.INCREASE);
|
|
var turnType = root.getCurrentSession().getTurnType();
|
|
|
|
if (turnType === TurnType.PLAYER) {
|
|
// 威圧
|
|
if (hasSkill(unit2, 19)) {
|
|
StateControl.arrangeState(unit, state, IncreaseType.INCREASE);
|
|
}
|
|
// 引きこもり
|
|
if (hasSkill(unit2, 30)) {
|
|
if (! hasSkill(unit, 54)) {
|
|
// ボス無効
|
|
state = StateControl._getState(5);
|
|
StateControl.arrangeState(unit, state, IncreaseType.INCREASE);
|
|
}
|
|
}
|
|
}
|
|
root.getMetaSession().getGlobalSwitchTable().setSwitch(4, false);
|
|
|
|
/*if (hasSkill(unit2, 19) && Math.random() >= 0.5) {
|
|
StateControl.arrangeState(unit, state, IncreaseType.INCREASE);
|
|
}*/
|
|
noEuipedWeaponUnits = {};
|
|
}
|
|
|
|
|
|
TurnChangeStart._checkStateTurn = function() {
|
|
var turnType = root.getCurrentSession().getTurnType();
|
|
|
|
if (turnType === TurnType.PLAYER) {
|
|
StateControl.decreaseTurn(PlayerList.getSortieList());
|
|
StateControl.decreaseTurn(AllyList.getAliveList());
|
|
} else if (turnType === TurnType.ENEMY) {
|
|
StateControl.decreaseTurn(EnemyList.getAliveList());
|
|
}
|
|
};
|
|
|
|
// ユニットに設定されているステートのターンを減少させる
|
|
StateControl.decreaseTurn2 = function(list) {
|
|
var i, j, count, count2, unit, arr, list2, turn, turnState;
|
|
|
|
count = list.getCount();
|
|
for (i = 0; i < count; i++) {
|
|
arr = [];
|
|
unit = list.getData(i);
|
|
list2 = unit.getTurnStateList();
|
|
count2 = list2.getCount();
|
|
for (j = 0; j < count2; j++) {
|
|
turnState = list2.getData(j);
|
|
var id = turnState.getState().getId();
|
|
turn = turnState.getTurn();
|
|
if (turn <= 0) {
|
|
continue;
|
|
}
|
|
|
|
// ターンを1つ減少させ、新たに設定する
|
|
turn--;
|
|
turnState.setTurn(turn);
|
|
if (turn <= 0) {
|
|
// ステートを後で解除するために配列へ保存する
|
|
arr.push(turnState.getState());
|
|
}
|
|
}
|
|
|
|
count2 = arr.length;
|
|
for (j = 0; j < count2; j++) {
|
|
this.arrangeState(unit, arr[j], IncreaseType.DECREASE);
|
|
}
|
|
}
|
|
};
|
|
|
|
|
|
UnitDeathFlowEntry._completeMemberData = function(coreAttack) {
|
|
root.getSceneController().notifyBattleEnd(this._activeUnit, this._passiveUnit);
|
|
|
|
// どちらのユニットも倒れていない場合は、処理を続行しない
|
|
if (!coreAttack.getAttackFlow().isBattleUnitLosted()) {
|
|
return EnterResult.NOTENTER;
|
|
}
|
|
|
|
if (DamageControl.isSyncope(this._passiveUnit)) {
|
|
return EnterResult.NOTENTER;
|
|
}
|
|
|
|
// UnitDeathFlowEntryはCoreAttackから使用されるが、
|
|
// CoreAttackにおけるスキップは必ず成功しなければならないため、
|
|
// 現在がスキップ状態の場合は無条件にスキップする。
|
|
if (this.isFlowSkip() || this._coreAttack.isBattleCut()) {
|
|
this._doEndAction();
|
|
return EnterResult.NOTENTER;
|
|
}
|
|
|
|
|
|
|
|
if (this._passiveUnit.getHp() == 0 && this._activeUnit.getUnitType() === UnitType.PLAYER) {
|
|
if (hasSkill(this._activeUnit, 17)) {
|
|
steal(this._passiveUnit);
|
|
}
|
|
}
|
|
if (this._activeUnit.getHp() == 0 && this._passiveUnit.getUnitType() === UnitType.PLAYER) {
|
|
if (hasSkill(this._passiveUnit, 17)) {
|
|
steal(this._activeUnit);
|
|
}
|
|
}
|
|
// 死亡時イベントを処理することを記録する
|
|
coreAttack.recordUnitLostEvent(true);
|
|
|
|
// イベントが存在しない、または終了できたかどうか
|
|
if (this._capsuleEvent.enterCapsuleEvent(UnitEventChecker.getUnitLostEvent(this._passiveUnit), false) === EnterResult.NOTENTER) {
|
|
if (this.isFlowSkip() || this._coreAttack.isBattleCut()) {
|
|
this._doEndAction();
|
|
return EnterResult.NOTENTER;
|
|
}
|
|
else {
|
|
this.changeCycleMode(UnitDeathMode.ERASE);
|
|
return EnterResult.OK;
|
|
}
|
|
}
|
|
|
|
this._playUnitDeathMusic();
|
|
|
|
this.changeCycleMode(UnitDeathMode.EVENT);
|
|
|
|
return EnterResult.OK;
|
|
};
|
|
|
|
function hasSkill(unit, id) {
|
|
if (! unit) {
|
|
return false;
|
|
}
|
|
var list = unit.getSkillReferenceList();
|
|
var count = list.getTypeCount();
|
|
for (var i = 0 ; i < count; i++) {
|
|
var skill = list.getTypeData(i);
|
|
if (skill.getId() === id) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
|
|
SkillRandomizer._isStateAttack = function(active, passive, skill) {
|
|
if (skill.getId() == 30) {
|
|
return !hasSkill(passive, 54);
|
|
}
|
|
return this._isSkillInvokedInternal(active, passive, skill);
|
|
};
|
|
|
|
AttackEvaluator.HitCritical.evaluateAttackEntry = function (virtualActive, virtualPassive, attackEntry) {
|
|
this._skill = SkillControl.checkAndPushSkill(virtualActive.unitSelf, virtualPassive.unitSelf, attackEntry, true, SkillType.TRUEHIT);
|
|
|
|
// 攻撃が命中するかどうかを調べる
|
|
attackEntry.isHit = this.isHit(virtualActive, virtualPassive, attackEntry);
|
|
if (!attackEntry.isHit) {
|
|
if (this._skill === null) {
|
|
// 攻撃が命中せず、スキルも発動しないため続行しない
|
|
if (hasSkill(virtualActive.unitSelf, 30)) {
|
|
// 引きこもりの呪縛
|
|
this._checkStateAttack(virtualActive, virtualPassive, attackEntry);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// スキルは発動しているため、攻撃は命中する
|
|
attackEntry.isHit = true;
|
|
}
|
|
|
|
// クリティカルかどうか調べる
|
|
attackEntry.isCritical = this.isCritical(virtualActive, virtualPassive, attackEntry);
|
|
|
|
// 与えるダメージを計算する
|
|
attackEntry.damagePassive = this.calculateDamage(virtualActive, virtualPassive, attackEntry);
|
|
|
|
// ステート攻撃におけるスキルとステートを確認する
|
|
this._checkStateAttack(virtualActive, virtualPassive, attackEntry);
|
|
}; |