Skip to content

Commit

Permalink
[fix] Fix #17 #20 and a bug for map list.
Browse files Browse the repository at this point in the history
  • Loading branch information
Babygogogo committed Nov 5, 2019
1 parent e0e585d commit 21a7a36
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
15 changes: 10 additions & 5 deletions src/modules/baseWar/model/BwPlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,18 @@ namespace TinyWars.BaseWar {
return (t === Types.CoSkillType.Power) || (t === Types.CoSkillType.SuperPower);
}
public checkHasZoneSkillForCurrentSkills(): boolean {
const version = this._war.getConfigVersion();
for (const skillId of this.getCoCurrentSkills() || []) {
if (ConfigManager.getCoSkillCfg(version, skillId).showZone) {
return true;
const currentSkills = this.getCoCurrentSkills();
if ((!currentSkills) || (!currentSkills.length)) {
return true;
} else {
const version = this._war.getConfigVersion();
for (const skillId of currentSkills) {
if (ConfigManager.getCoSkillCfg(version, skillId).showZone) {
return true;
}
}
return false;
}
return false;
}

public getCoIsDestroyedInTurn(): boolean {
Expand Down
10 changes: 9 additions & 1 deletion src/modules/multiCustomRoom/view/McrCreateMapListPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,15 @@ namespace TinyWars.MultiCustomRoom {
this._labelNoMap.visible = length <= 0;
this._listMap.bindData(this._dataForList);
this.setSelectedMapFileName(this._selectedMapFileName);
(length) && (this._listMap.scrollVerticalTo((this._dataForList.findIndex(data => data.mapFileName === this._selectedMapFileName) + 1) / length * 100));

if (length) {
for (let index = 0; index < length; ++index) {
if (this._dataForList[index].mapFileName === this._selectedMapFileName) {
this._listMap.scrollVerticalTo((index + 1) / length * 100);
break;
}
}
}
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
10 changes: 7 additions & 3 deletions src/modules/multiCustomWar/model/McwActionPlanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,10 +475,14 @@ namespace TinyWars.MultiCustomWar {
}
} else {
if (this._checkCanFocusUnitOnMapAttackTarget(gridIndex)) {
if (GridIndexHelpers.checkIsEqual(gridIndex, this.getCursor().getPreviousGridIndex())) {
return State.RequestingUnitAttack;
} else {
if (!GridIndexHelpers.checkIsEqual(gridIndex, this.getCursor().getPreviousGridIndex())) {
return State.MakingMovePath;
} else {
if (this.getFocusUnit().checkCanAttackTargetAfterMovePath(this.getMovePath(), gridIndex)) {
return State.RequestingUnitAttack;
} else {
return State.MakingMovePath;
}
}
} else {
if (this.getFocusUnitLoaded()) {
Expand Down

1 comment on commit 21a7a36

@RushFTK
Copy link
Contributor

@RushFTK RushFTK commented on 21a7a36 Nov 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related #27

Please sign in to comment.