97 lines
No EOL
3.6 KiB
JavaScript
97 lines
No EOL
3.6 KiB
JavaScript
//=============================================================================
|
|
// MW_Function.js
|
|
//=============================================================================
|
|
/*:
|
|
* @plugindesc 自作関数を定義します
|
|
* @author みるきーうぇい
|
|
* @help
|
|
* よく使う処理を関数と定義してスクリプトで呼べるようにします。
|
|
*/
|
|
|
|
function ValClamp(n,a,b){
|
|
$gameVariables.setValue(n, $gameVariables.value(n).clamp(a, b))
|
|
};
|
|
|
|
function ReCanEquip(actor, item) {
|
|
var equipId = $gameActors.actor(1)._equips[1]._itemId;
|
|
if (equipId === 0) return true;
|
|
if (!item.meta["SZLEQ"]) {
|
|
return true;
|
|
}
|
|
var meta = item.meta["SZLEQ"];
|
|
meta = meta.replace(/SceneManager\._scene\.constructor === Scene_Map\s*&&\s*/g, '');
|
|
meta = meta.replace(/&&\s*SceneManager\._scene\.constructor === Scene_Map/g, '');
|
|
meta = meta.replace(/SceneManager\._scene\.constructor === Scene_Map\s*\|\|\s*/g, '');
|
|
meta = meta.replace(/\|\|\s*SceneManager\._scene\.constructor === Scene_Map/g, '');
|
|
var param = actor.escapeLimitEquipParameter(meta);
|
|
try {
|
|
return (new Function("return !!(" + param + ");"))();
|
|
} catch (e) {
|
|
console.error("Error evaluating equip condition: ", param);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function increaseDamageBasedOnProbability() {
|
|
//絶頂回数*10%の確率で快感ダメージ+1
|
|
var a = $gameVariables.value(78) * 0.1;
|
|
|
|
if (Math.random() < a) {
|
|
$gameVariables._data[87] += 1;
|
|
}
|
|
//強制淫乱化
|
|
if($gameActors.actor(1).isStateAffected(72)){
|
|
if(Math.floor(Math.random() < 0.5))$gameVariables._data[87] += 1;
|
|
}
|
|
//ギャンブルチップ
|
|
if($gameActors.actor(1).hasArmor($dataArmors[100])){
|
|
if(Math.floor(Math.random() < 0.5)){
|
|
$gameVariables._data[87] += 1;
|
|
}else{
|
|
if($gameVariables._data[87]>=1)$gameVariables._data[87] -= 1;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
(function() {
|
|
// 元の移動処理を上書き
|
|
var _Game_Player_moveStraight = Game_Player.prototype.moveStraight;
|
|
Game_Player.prototype.moveStraight = function(d) {
|
|
// プレイヤーの現在位置の1歩先のリージョンIDを取得
|
|
var x2 = $gameMap.roundXWithDirection(this.x, d);
|
|
var y2 = $gameMap.roundYWithDirection(this.y, d);
|
|
var regionId = $gameMap.regionId(x2, y2);
|
|
var playerRegion = $gameMap.regionId($gamePlayer.x, $gamePlayer.y)
|
|
|
|
// リージョン1に移動する前にコモンイベントを実行
|
|
if (regionId === 36 && playerRegion === 35) {
|
|
var eventExist0 = $gameMap.eventIdXy(x2, y2);
|
|
var eventExist1 = 0;
|
|
if(d == 2){
|
|
eventExist1 = $gameMap.eventIdXy(x2 , y2+1);
|
|
}else if(d == 4){
|
|
eventExist1 = $gameMap.eventIdXy(x2-1, y2 );
|
|
}else if(d == 6){
|
|
eventExist1 = $gameMap.eventIdXy(x2+1, y2 );
|
|
}else{
|
|
eventExist1 = $gameMap.eventIdXy(x2 , y2-1);
|
|
}
|
|
if(eventExist1 > 0 && $gameMap.event(eventExist1).characterName() === "")eventExist1=0
|
|
if(eventExist0 <= 0 && eventExist1 <= 0){
|
|
$gamePlayer.setDirection(d);
|
|
$gameSwitches.setValue(329,true)
|
|
$gameTemp.reserveCommonEvent(245);
|
|
}else if(eventExist0 <= 0){
|
|
console.log("飛び込みナシ入水")
|
|
_Game_Player_moveStraight.call(this, d);
|
|
$gameTemp.reserveCommonEvent(245);
|
|
}else{
|
|
console.log("通常移動、進行不可")
|
|
_Game_Player_moveStraight.call(this, d);
|
|
}
|
|
}else{
|
|
_Game_Player_moveStraight.call(this, d);
|
|
}
|
|
};
|
|
})(); |