Commit 2e1423fa authored by zjz1994's avatar zjz1994

草坪功能暂存

parent 3a8b4f9d
...@@ -250,6 +250,7 @@ export default class MainScene extends Scene { ...@@ -250,6 +250,7 @@ export default class MainScene extends Scene {
elementContainer: egret.DisplayObjectContainer; elementContainer: egret.DisplayObjectContainer;
//虫洞层 //虫洞层
wormholeContainer:egret.DisplayObjectContainer; wormholeContainer:egret.DisplayObjectContainer;
mapbotContainer:egret.DisplayObjectContainer;
//流沙提出来,解决流沙抖动问题 //流沙提出来,解决流沙抖动问题
mapupContainer:egret.DisplayObjectContainer; mapupContainer:egret.DisplayObjectContainer;
//选中框 //选中框
...@@ -429,6 +430,9 @@ export default class MainScene extends Scene { ...@@ -429,6 +430,9 @@ export default class MainScene extends Scene {
this.wormholeContainer = new egret.DisplayObjectContainer(); this.wormholeContainer = new egret.DisplayObjectContainer();
this.addChild(this.wormholeContainer); this.addChild(this.wormholeContainer);
//底部草坪
this.mapbotContainer = new egret.DisplayObjectContainer();
this.addChild(this.mapbotContainer);
//修改流沙的问题 //修改流沙的问题
this.mapupContainer = new egret.DisplayObjectContainer(); this.mapupContainer = new egret.DisplayObjectContainer();
this.addChild(this.mapupContainer); this.addChild(this.mapupContainer);
...@@ -487,6 +491,7 @@ export default class MainScene extends Scene { ...@@ -487,6 +491,7 @@ export default class MainScene extends Scene {
this.mapContainer.removeChildren(); this.mapContainer.removeChildren();
this.mapbotContainer.removeChildren();
this.mapupContainer.removeChildren(); this.mapupContainer.removeChildren();
this.elementContainer.removeChildren(); this.elementContainer.removeChildren();
this.effectContainer.removeChildren(); this.effectContainer.removeChildren();
...@@ -1908,6 +1913,8 @@ export default class MainScene extends Scene { ...@@ -1908,6 +1913,8 @@ export default class MainScene extends Scene {
if(s) { if(s) {
this.wormHolePromise = new Array(); this.wormHolePromise = new Array();
this.wormFireworks = new Array(); this.wormFireworks = new Array();
//成功的 //成功的
switch(prop) { switch(prop) {
case PropType.BOOM: case PropType.BOOM:
...@@ -1930,12 +1937,16 @@ export default class MainScene extends Scene { ...@@ -1930,12 +1937,16 @@ export default class MainScene extends Scene {
// } // }
// } // }
// } // }
var grassArr = new Array();
var canturgrass = Tool.judgeTurfing(this.lattices[index]);
//新增石头阻挡 //新增石头阻挡
var elimitarr = this.getEliPassCannoStone(rc[0],rc[1]); var elimitarr = this.getEliPassCannoStone(rc[0],rc[1]);
for(var j=0;j<elimitarr.length;j++){ for(var j=0;j<elimitarr.length;j++){
var jelidx = elimitarr[j]; var jelidx = elimitarr[j];
var jlat = this.lattices[jelidx]; var jlat = this.lattices[jelidx];
if(canturgrass&&Tool.judgeTurfto(jlat)){
grassArr.push(jelidx);
}
if(this.eliminatedElements.indexOf(jelidx)==-1){ if(this.eliminatedElements.indexOf(jelidx)==-1){
this.eliminatedElements.push(jelidx); this.eliminatedElements.push(jelidx);
if(jlat.element.type == ElementType.FISH){ if(jlat.element.type == ElementType.FISH){
...@@ -1973,6 +1984,9 @@ export default class MainScene extends Scene { ...@@ -1973,6 +1984,9 @@ export default class MainScene extends Scene {
this.checkPongoHVEle(rc[0],rc[1],"vir"); this.checkPongoHVEle(rc[0],rc[1],"vir");
setTimeout(() => { setTimeout(() => {
if(grassArr.length>0){
this.changeGroGrass(grassArr);
}
this.initOneElmtTag(); this.initOneElmtTag();
this.eliminate(pcannostatArr); this.eliminate(pcannostatArr);
}, 200) }, 200)
...@@ -3423,6 +3437,12 @@ export default class MainScene extends Scene { ...@@ -3423,6 +3437,12 @@ export default class MainScene extends Scene {
} }
} }
//炮台上有草坪的处理
var grassArr = new Array();
var canturgrass = false;
if(this.lattices[canno.index].grass){
canturgrass = true;
}
//特效消除猩猩--炮弹 //特效消除猩猩--炮弹
var lockPongoArr:Array<{idx:number,part:string}> = new Array(); var lockPongoArr:Array<{idx:number,part:string}> = new Array();
for(var j=0;j<cannoFireArr.length;j++){ for(var j=0;j<cannoFireArr.length;j++){
...@@ -3440,6 +3460,13 @@ export default class MainScene extends Scene { ...@@ -3440,6 +3460,13 @@ export default class MainScene extends Scene {
break; break;
} }
} }
if(canturgrass){
if(Tool.judgeTurfto(lat)){
grassArr.push(jemitidx);
}else{
canturgrass = false;
}
}
//提前消除了,需要修改成炮台的消除时消除 //提前消除了,需要修改成炮台的消除时消除
if(lat&&lat.element){ if(lat&&lat.element){
...@@ -3453,6 +3480,9 @@ export default class MainScene extends Scene { ...@@ -3453,6 +3480,9 @@ export default class MainScene extends Scene {
} }
if(this.fireteamCannoArr.length==this.readyCannoArr.length){ if(this.fireteamCannoArr.length==this.readyCannoArr.length){
if(grassArr.length>0){
this.changeGroGrass(grassArr);
}
this.eliminate(); this.eliminate();
for(var i=0;i<this.readyCannoArr.length;i++){ for(var i=0;i<this.readyCannoArr.length;i++){
var preadyCannoIdx = this.readyCannoArr[i]; var preadyCannoIdx = this.readyCannoArr[i];
...@@ -3609,6 +3639,21 @@ export default class MainScene extends Scene { ...@@ -3609,6 +3639,21 @@ export default class MainScene extends Scene {
var two = this.eliminatedElements[1]; var two = this.eliminatedElements[1];
let lat1 = this.lattices[one]; let lat1 = this.lattices[one];
let lat2 = this.lattices[two]; let lat2 = this.lattices[two];
//特效铺草坪
var grassArr = new Array();
var canturgrass = Tool.judgeTurfing(lat1)||Tool.judgeTurfing(lat2);
if(canturgrass){
if(Tool.judgeTurfto(lat1)){
grassArr.push(one);
}
if(Tool.judgeTurfto(lat2)){
grassArr.push(two);
}
}
let ele1: Element = this.lattices[one].element; let ele1: Element = this.lattices[one].element;
let ele2: Element = this.lattices[two].element; let ele2: Element = this.lattices[two].element;
//置空,没用了已经 //置空,没用了已经
...@@ -3638,6 +3683,9 @@ export default class MainScene extends Scene { ...@@ -3638,6 +3683,9 @@ export default class MainScene extends Scene {
for(var i = 0; i < this.lattices.length; i++) { for(var i = 0; i < this.lattices.length; i++) {
var lat = this.lattices[i]; var lat = this.lattices[i];
if(Tool.judgeEliminate(lat)) { if(Tool.judgeEliminate(lat)) {
if(canturgrass&&Tool.judgeTurfto(lat)){
grassArr.push(i);
}
//本来没必要判断特效组合时是否有重复的消除元素,但是recoverEle里会有判断石头或果冻的加入,造成重复 //本来没必要判断特效组合时是否有重复的消除元素,但是recoverEle里会有判断石头或果冻的加入,造成重复
if(this.eliminatedElements.indexOf(i) == -1) this.eliminatedElements.push(i); if(this.eliminatedElements.indexOf(i) == -1) this.eliminatedElements.push(i);
if(this.lattices[i].element.type == ElementType.FISH) { if(this.lattices[i].element.type == ElementType.FISH) {
...@@ -3691,6 +3739,9 @@ export default class MainScene extends Scene { ...@@ -3691,6 +3739,9 @@ export default class MainScene extends Scene {
lat.element.effectType != EffectType.MAGICLION && //不能是魔力鸟特效 lat.element.effectType != EffectType.MAGICLION && //不能是魔力鸟特效
lat.element.type == other.type //类型相等 lat.element.type == other.type //类型相等
) { ) {
if(canturgrass&&Tool.judgeTurfto(lat)){
grassArr.push(i);
}
//一个魔力鸟时其实不用加,因为石头或果冻的不会进入判断 //一个魔力鸟时其实不用加,因为石头或果冻的不会进入判断
if(this.eliminatedElements.indexOf(i) == -1) this.eliminatedElements.push(i); if(this.eliminatedElements.indexOf(i) == -1) this.eliminatedElements.push(i);
//如果other带特效,符合的元素都加上特效,没动效,直接加吧先, //如果other带特效,符合的元素都加上特效,没动效,直接加吧先,
...@@ -3756,6 +3807,9 @@ export default class MainScene extends Scene { ...@@ -3756,6 +3807,9 @@ export default class MainScene extends Scene {
for(var j=0;j<elimitarr.length;j++){ for(var j=0;j<elimitarr.length;j++){
var jelidx = elimitarr[j]; var jelidx = elimitarr[j];
var jlat = this.lattices[jelidx]; var jlat = this.lattices[jelidx];
if(canturgrass&&Tool.judgeTurfto(jlat)){
grassArr.push(jelidx);
}
if(this.eliminatedElements.indexOf(jelidx)==-1){ if(this.eliminatedElements.indexOf(jelidx)==-1){
this.eliminatedElements.push(jelidx); this.eliminatedElements.push(jelidx);
if(jlat.element.type == ElementType.FISH){ if(jlat.element.type == ElementType.FISH){
...@@ -3875,6 +3929,10 @@ export default class MainScene extends Scene { ...@@ -3875,6 +3929,10 @@ export default class MainScene extends Scene {
var lat = this.lattices[i]; var lat = this.lattices[i];
if(Tool.judgeEliminate(lat) && if(Tool.judgeEliminate(lat) &&
(Math.abs(lat.row - lat1.row) < 2 || Math.abs(lat.column - lat1.column) < 2)) { (Math.abs(lat.row - lat1.row) < 2 || Math.abs(lat.column - lat1.column) < 2)) {
if(canturgrass&&Tool.judgeTurfto(lat)){
grassArr.push(i);
}
if(this.eliminatedElements.indexOf(i) == -1) this.eliminatedElements.push(i); if(this.eliminatedElements.indexOf(i) == -1) this.eliminatedElements.push(i);
if(this.lattices[i].element.type == ElementType.FISH) { if(this.lattices[i].element.type == ElementType.FISH) {
this.lattices[i].element.nextFishState(); this.lattices[i].element.nextFishState();
...@@ -3914,6 +3972,10 @@ export default class MainScene extends Scene { ...@@ -3914,6 +3972,10 @@ export default class MainScene extends Scene {
var lat = this.lattices[i]; var lat = this.lattices[i];
if(Tool.judgeEliminate(lat) && if(Tool.judgeEliminate(lat) &&
(Math.abs(lat.row - lat1.row) < 3 && Math.abs(lat.column - lat1.column) < 3)) { (Math.abs(lat.row - lat1.row) < 3 && Math.abs(lat.column - lat1.column) < 3)) {
if(canturgrass&&Tool.judgeTurfto(lat)){
grassArr.push(i);
}
if(this.eliminatedElements.indexOf(i) == -1) this.eliminatedElements.push(i); if(this.eliminatedElements.indexOf(i) == -1) this.eliminatedElements.push(i);
if(this.lattices[i].element.type == ElementType.FISH) { if(this.lattices[i].element.type == ElementType.FISH) {
this.lattices[i].element.nextFishState(); this.lattices[i].element.nextFishState();
...@@ -3925,6 +3987,12 @@ export default class MainScene extends Scene { ...@@ -3925,6 +3987,12 @@ export default class MainScene extends Scene {
} }
} }
} }
if(grassArr.length>0){
setTimeout(() => {
this.changeGroGrass(grassArr);
}, 200);
}
} }
/** /**
...@@ -5789,44 +5857,49 @@ export default class MainScene extends Scene { ...@@ -5789,44 +5857,49 @@ export default class MainScene extends Scene {
if(Tool.judgeTurfing(jlat)){ if(Tool.judgeTurfing(jlat)){
canturgrass = true; canturgrass = true;
}else{ }else{
if(Tool.judgeTurfto(jlat)){
needpuarr.push(igrassarr[j]); needpuarr.push(igrassarr[j]);
} }
} }
}
if(canturgrass&&needpuarr.length>0){ if(canturgrass&&needpuarr.length>0){
this.changeGroGrass(needpuarr);
}
}
}
changeGroGrass(needpuarr:Array<number>){
for(let p=0;p<needpuarr.length;p++){ for(let p=0;p<needpuarr.length;p++){
let pidx = needpuarr[p]; let pidx = needpuarr[p];
this.turfing(pidx); this.turfing(pidx);
} }
} }
}
}
//新增铺草地 //新增铺草地
turfing(index:number){ turfing(index:number){
var lat = this.lattices[index]; var lat = this.lattices[index];
if(lat&&lat.element){//消除元素铺草坪 if(lat&&lat.element){//消除元素铺草坪
//存在冰块和流沙时,草坪铺不上去 //存在冰块和流沙时,草坪铺不上去
if(lat.ice&&lat.ice.alpha!=0){ // if(lat.ice&&lat.ice.alpha!=0){
return; // return;
} // }
else if(lat.block&&lat.block.ice&&lat.block.canIceBroken&&lat.block.ice.alpha!=0){ // else if(lat.block&&lat.block.ice&&lat.block.canIceBroken&&lat.block.ice.alpha!=0){
return; // return;
} // }
else if(lat.sand){ // else if(lat.sand){
return; // return;
} // }
if(!lat.grass){ // if(!lat.grass){
let grassDisplay = Pool.takeOut(RecoverName.GRASS); let grassDisplay = Pool.takeOut(RecoverName.GRASS);
if(!grassDisplay){ if(!grassDisplay){
grassDisplay = new Grass(); grassDisplay = new Grass();
} }
lat.grass = grassDisplay; lat.grass = grassDisplay;
this.mapupContainer.addChild(grassDisplay); this.mapbotContainer.addChild(grassDisplay);
var grasspos = Tool.getPositionByIndex(index); var grasspos = Tool.getPositionByIndex(index);
grassDisplay.x = grasspos[0]; grassDisplay.x = grasspos[0];
grassDisplay.y = grasspos[1]; grassDisplay.y = grasspos[1];
} // }
} }
} }
} }
\ No newline at end of file
...@@ -1340,5 +1340,27 @@ export class Tool { ...@@ -1340,5 +1340,27 @@ export class Tool {
return true; return true;
} }
//草坪能否铺上去 //草坪能否铺上去
public static judgeTurfto(lat:Lattice){
if(!lat||!lat.element){
return false;
}
if(lat.ice&&lat.ice.alpha!=0){
return false;
}
if(lat.block && lat.block.ice && lat.block.canIceBroken && lat.block.ice.alpha!=0) {
return false;
}
if(lat.sand){
return false;
}
let ele = lat.element;
let canChosen = this.judgeChosen(ele);
if(!canChosen){
return false;
}
if(lat.grass){
return false;
}
return true;
}
} }
\ No newline at end of file
...@@ -2,5 +2,41 @@ import { ChapterData } from "../interface/ChapterData"; ...@@ -2,5 +2,41 @@ import { ChapterData } from "../interface/ChapterData";
//676-700 //676-700
export const Chapters27: ChapterData[] = [ export const Chapters27: ChapterData[] = [
{
baseElementTypes: [ 0, 3, 4, 2 ], bubbleProbability: 0, stepCount: 27,
passTarget: { type: 1, elements: [ { type: 1, count: 62 }, { type: 0, count: 102 }, { type: 34, count: 10 } ] }, starScores: [ 15000, 20000, 25000 ],
map: {
lattices: [
1, 1, 1, 1, 0, 1, 1, 1, 1,
1, 8, 1, 1, 0, 1, 1, 1, 1,
1, 1, 1, 1, 0, 1, 1, 1, 1,
1, 1, 1, 1, 0, 1, 1, 1, 1,
1, 1, 1, 1, 0, 1, 1, 1, 1,
41, 1, 41, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1 ],
connectedLats: [ [ 41, 59 ], [ 42, 60 ], [ 43, 61 ], [ 44, 62 ] ],
conveyor: [], conveyorConnectedLats: [], WORMHOLE: [],
elements: [
2, 1, 2, 1, 1, 2, 1, 2, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
16, 2, 16, 2, 1, 6, 6, 6, 6,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1 ],
baseElements: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0 ],
recycles: [], generateLats: [ { index: 0, type: null }, { index: 1, type: null }, { index: 2, type: null }, { index: 3, type: null }, { index: 5, type: null }, { index: 6, type: null }, { index: 7, type: null }, { index: 8, type: null }, { index: 58, type: null } ] } },
] ]
...@@ -78,7 +78,7 @@ chapters.forEach((chapter,index) => { ...@@ -78,7 +78,7 @@ chapters.forEach((chapter,index) => {
*/ */
export function getChapterData(index: number): ChapterData { export function getChapterData(index: number): ChapterData {
//没有数据就返回第一关数据 //没有数据就返回第一关数据
return chapters[658]; return chapters[676];
return chapters[index] || chapters[1]; return chapters[index] || chapters[1];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment