Skip to content
This repository has been archived by the owner on Jun 30, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
matsuyuki-a committed Apr 29, 2019
2 parents 0f5ee41 + 00bb3d2 commit 0f3cf51
Show file tree
Hide file tree
Showing 10 changed files with 937 additions and 1,001 deletions.
1,812 changes: 854 additions & 958 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"bootstrap:no-hoist": "lerna bootstrap",
"clean": "lerna clean",
"start": "lerna run start --stream --scope @wwawing/engine",
"build": "lerna run build --stream --parallel",
"build": "lerna run build --stream",
"generate": "lerna exec --scope @wwawing/debug-server -- npm run generate",
"make-dist": "npm run build && lerna run make-dist --stream"
},
Expand Down
7 changes: 7 additions & 0 deletions packages/assets/html/manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ <h2>注意</h2>
<section>
<h2>更新情報</h2>
<section>
<h3>v3.1.6からv3.1.7への変更点</h3>
<ul>
<li>Java版WWAに実装されていた<code>$effitem</code>マクロを復活</li>
<li>メッセージがマクロのみのスコア法事パーツでメッセージが消えない問題を修正</li>
<li>メッセージの先頭にある空白文字(半角スペースなど)が表示されない問題を修正</li>
<li>クラシックモードかつタイトル画像が指定されている場合のプログレスバースタイル表示スタイルを修正</li>
</ul>
<h3>W3.15dβ2からv3.1.6への変更点</h3>
<ul>
<li>新しいビルド方式に移行</li>
Expand Down
Binary file modified packages/assets/mapdata/test.dat
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/build-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@types/node": "^10.5.1",
"@types/shelljs": "^0.8.0",
"@wwawing/html-generator": "git+https://[email protected]/WWAWing/html-generator.git#include-lib",
"@wwawing/engine": "3.1.6",
"@wwawing/engine": "3.1.7",
"@wwawing/assets": "0.0.0",
"@wwawing/loader": "0.0.0",
"@wwawing/debug-server": "0.0.0",
Expand Down
7 changes: 5 additions & 2 deletions packages/common-interface/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions packages/debug-server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/engine/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wwawing/engine",
"version": "3.1.6",
"version": "3.1.7",
"description": "World Wide Adventure: an RPG Engine.",
"main": "wwa.js",
"scripts": {
Expand Down
13 changes: 12 additions & 1 deletion packages/engine/src/wwa_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,18 @@ export class Status extends EquipmentStatus {
return this.energy === e.energy && this.strength === e.strength && this.defence === e.defence && this.gold === e.gold;
}

public constructor(e: number, s: number, d: number, g: number) {
public calculateScore(weight: {
energy: number;
strength: number;
defence: number;
gold: number;
}): number {
type Key = keyof typeof weight;
// TODO: this[key] など型が効いていない部分があるが、一旦目を瞑る。
return (Object.keys(weight) as Key[]).reduce((prev, key) => prev + weight[key] * this[key], 0);
}

public constructor( e: number, s: number, d: number, g: number) {
super(s, d);
this.energy = e;
this.gold = g;
Expand Down
86 changes: 51 additions & 35 deletions packages/engine/src/wwa_main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2620,18 +2620,37 @@ export class WWA {
this._yesNoURL = this._wwaData.message[messageID].split(/\s/g)[0];
}

/**
* 物体パーツ「スコア表示」のイベントを実行します
*
* 動作仕様
*
* - メッセージが空の場合は「スコアを表示します。」というメッセージとともにスコア表示がされる
* - メッセージがマクロのみの場合はマクロのみが実行され、スコアが表示されない
* - メッセージがある場合はそのメッセージとともにスコアが表示される
*
* メッセージがマクロのみの場合の挙動は、Java版(v3.10)に準拠するためのものであり、将来変更される可能性があります。
*
* @param pos パーツの座標
* @param partsID パーツの物体番号
* @param mapAttr パーツの ATR_TYPE の値
*/
private _execObjectScoreEvent(pos: Coord, partsID: number, mapAttr: number): void {
var messageID = this._wwaData.objectAttribute[partsID][Consts.ATR_STRING];
var playerPos = this._player.getPosition().getPartsCoord();
var playerStatus = this._player.getStatus();
var score = 0;
score += this._wwaData.objectAttribute[partsID][Consts.ATR_ENERGY] * playerStatus.energy;
score += this._wwaData.objectAttribute[partsID][Consts.ATR_STRENGTH] * playerStatus.strength;
score += this._wwaData.objectAttribute[partsID][Consts.ATR_DEFENCE] * playerStatus.defence;
score += this._wwaData.objectAttribute[partsID][Consts.ATR_GOLD] * playerStatus.gold;
this._scoreWindow.update(score);
this._scoreWindow.show();
this.setMessageQueue(messageID === 0 ? "スコアを表示します。" : this._wwaData.message[messageID], false, false, partsID, PartsType.OBJECT, pos);
const rawMessage = messageID === 0 ? "スコアを表示します。" : this._wwaData.message[messageID];
const messageQueue = this.getMessageQueueByRawMessage(rawMessage, partsID, PartsType.OBJECT, pos);
const existsMessage = messageQueue.reduce((existsMessageBefore, messageInfo) => existsMessageBefore || !!messageInfo.message, false);
if (existsMessage) {
const score = this._player.getStatus().calculateScore({
energy: this._wwaData.objectAttribute[partsID][Consts.ATR_ENERGY],
strength: this._wwaData.objectAttribute[partsID][Consts.ATR_STRENGTH],
defence: this._wwaData.objectAttribute[partsID][Consts.ATR_DEFENCE],
gold: this._wwaData.objectAttribute[partsID][Consts.ATR_GOLD]
});
this._scoreWindow.update(score);
this._scoreWindow.show();
}
this.setMessageQueue(rawMessage, false, false, partsID, PartsType.OBJECT, pos);
this.playSound(this._wwaData.objectAttribute[partsID][Consts.ATR_SOUND]);

}
Expand Down Expand Up @@ -3174,8 +3193,9 @@ export class WWA {
}

public setStatusChangedEffect(additionalStatus: EquipmentStatus) {


if (!this._wwaData.isItemEffectEnabled) {
return;
}
if (additionalStatus.strength !== 0) {
util.$id("disp-strength").classList.add("onpress");
this._statusPressCounter.strength = Consts.STATUS_CHANGED_EFFECT_FRAME_NUM;
Expand Down Expand Up @@ -3974,6 +3994,7 @@ export class WWA {
this._camera.getPosition()
);
this._messageWindow.show();
this._player.setMessageWaiting();
} else {
if (this._messageQueue.length === 0) {
this._hideMessageWindow();
Expand Down Expand Up @@ -4258,7 +4279,6 @@ export class WWA {
this.updateCSSRule();
}
public updateCSSRule() {
var messageOpacity = this._isClassicModeEnable ? 1 : 0.9;
if (this._stylePos === void 0) {
this._stylePos = new Array(2);
} else {
Expand All @@ -4272,30 +4292,26 @@ export class WWA {
}
}
}
const messageWindowStyleSelector = "div.wwa-message-window, div#wwa-battle-estimate, div#wwa-password-window";
const messageWindowOpacity = this._isClassicModeEnable ? 1 : 0.9;
const messageWindowStyleRules = `
background-color: rgba(${this._wwaData.frameColorR}, ${this._wwaData.frameColorG}, ${this._wwaData.frameColorB}, ${messageWindowOpacity});
border-color: rgba(${this._wwaData.frameOutColorR}, ${this._wwaData.frameOutColorG}, ${this._wwaData.frameOutColorB }, 1);
color: rgba(${this._wwaData.fontColorR}, ${this._wwaData.fontColorG}, ${this._wwaData.fontColorB}, 1);
white-space: pre-wrap;
`;
const sidebarStyleSelector = "div#wwa-sidebar";
const sidebarStyleRules = `
color: rgba(${this._wwaData.statusColorR}, ${this._wwaData.statusColorG}, ${this._wwaData.statusColorB},1);
font-weight: bold;
`;

if (this._sheet.addRule !== void 0) {
this._stylePos[SelectorType.MESSAGE_WINDOW] = this._sheet.addRule(
"div.wwa-message-window, div#wwa-battle-estimate, div#wwa-password-window",
"background-color: rgba(" + this._wwaData.frameColorR + "," + this._wwaData.frameColorG + "," + this._wwaData.frameColorB + ", " + messageOpacity + ");" +
"border-color: rgba(" + this._wwaData.frameOutColorR + "," + this._wwaData.frameOutColorG + "," + this._wwaData.frameOutColorB + ", 1);" +
"color: rgba(" + this._wwaData.fontColorR + "," + this._wwaData.fontColorG + "," + this._wwaData.fontColorB + ", 1);"
);
this._stylePos[SelectorType.SIDEBAR] = this._sheet.addRule(
"div#wwa-sidebar",
"color: rgba(" + this._wwaData.statusColorR + "," + this._wwaData.statusColorG + "," + this._wwaData.statusColorB + ",1);" +
"font-weight: bold;"
);
this._stylePos[SelectorType.MESSAGE_WINDOW] = this._sheet.addRule(messageWindowStyleSelector,messageWindowStyleRules);
this._stylePos[SelectorType.SIDEBAR] = this._sheet.addRule(sidebarStyleSelector, sidebarStyleRules);
} else {
this._stylePos[SelectorType.MESSAGE_WINDOW] = this._sheet.insertRule(
"div.wwa-message-window, div#wwa-battle-estimate, div#wwa-password-window {\n" +
"background-color: rgba(" + this._wwaData.frameColorR + "," + this._wwaData.frameColorG + "," + this._wwaData.frameColorB + ", " + messageOpacity + ");\n" +
"border-color: rgba(" + this._wwaData.frameOutColorR + "," + this._wwaData.frameOutColorG + "," + this._wwaData.frameOutColorB + ", 1);\n" +
"color: rgba(" + this._wwaData.fontColorR + "," + this._wwaData.fontColorG + "," + this._wwaData.fontColorB + ", 1);\n" +
"}", 0);
this._stylePos[SelectorType.SIDEBAR] = this._sheet.insertRule(
"div#wwa-sidebar {\n" +
"color: rgba(" + this._wwaData.statusColorR + "," + this._wwaData.statusColorG + "," + this._wwaData.statusColorB + ",1);\n" +
"font-weight: bold;\n" +
"}", 1);
this._stylePos[SelectorType.MESSAGE_WINDOW] = this._sheet.insertRule(`${messageWindowStyleSelector} { ${messageWindowStyleRules} }`, 0);
this._stylePos[SelectorType.SIDEBAR] = this._sheet.insertRule(`${sidebarStyleSelector} { ${sidebarStyleRules} }`, 1);
}
}
public changeStyleRule(type: ChangeStyleType, r: number, g: number, b: number) {
Expand Down

0 comments on commit 0f3cf51

Please sign in to comment.