Commit 5de9a8d7 authored by zjz1994's avatar zjz1994

调整铺草时机,添加无藤曼猩猩部位特效铺草

parent 2e1423fa
......@@ -2036,6 +2036,9 @@ export default class MainScene extends Scene {
jellymo:true,
bubble:true,
};
this.turfingArr = new Array();
}
//横向消除,不包括炮台石头
getEliHorPassCannoStone(row:number,col:number){
......@@ -4224,6 +4227,8 @@ export default class MainScene extends Scene {
let ele = lat.element;
if(!ele)continue;
var p = Tool.getPositionByIndex(index);
var canturgrass = Tool.judgeTurfing(lat);
var grassArr = new Array();
switch(ele.effectType) {
case EffectType.MAGICLION:
if(sounds.indexOf(SoundType.magic) == -1) sounds.push(SoundType.magic)
......@@ -4257,7 +4262,11 @@ export default class MainScene extends Scene {
this.lattices[i].element.effectType != EffectType.MAGICLION && //不是魔力鸟
this.lattices[i].element.type == type //类型相等
) {
if(this.eliminatedElements.indexOf(i) < 0 && effectIndexs.indexOf(i) < 0) {
if(canturgrass&&Tool.judgeTurfto(this.lattices[i])){
grassArr.push(i);
}
this.eliminatedElements.push(i);
//无特效未枷锁,无毛球的参与旋转
if(Tool.judgeMagicRotate(this.lattices[i].element)) {
......@@ -4290,6 +4299,9 @@ export default class MainScene extends Scene {
if(Tool.judgeEliminate(this.lattices[i]) &&
(Math.abs(this.lattices[i].row - lat.row) < 2 && Math.abs(this.lattices[i].column - lat.column) < 2)) {
if(this.eliminatedElements.indexOf(i) < 0 && effectIndexs.indexOf(i) < 0) {
if(canturgrass&&Tool.judgeTurfto(this.lattices[i])){
grassArr.push(i);
}
this.eliminatedElements.push(i);
if(this.lattices[i].element.type == ElementType.FISH) {
this.lattices[i].element.nextFishState();
......@@ -4337,6 +4349,9 @@ export default class MainScene extends Scene {
var jelidx = elimitarr[j1];
var jlat = this.lattices[jelidx];
if(this.eliminatedElements.indexOf(jelidx)==-1&&effectIndexs.indexOf(jelidx)==-1){
if(canturgrass&&Tool.judgeTurfto(jlat)){
grassArr.push(jelidx);
}
this.eliminatedElements.push(jelidx);
if(jlat.element.type==ElementType.FISH){
jlat.element.nextFishState();
......@@ -4393,6 +4408,9 @@ export default class MainScene extends Scene {
var jelidx = elimitarr[j1];
var jlat = this.lattices[jelidx];
if(this.eliminatedElements.indexOf(jelidx)==-1&&effectIndexs.indexOf(jelidx)==-1){
if(canturgrass&&Tool.judgeTurfto(jlat)){
grassArr.push(jelidx);
}
this.eliminatedElements.push(jelidx);
if(jlat.element.type==ElementType.FISH){
jlat.element.nextFishState();
......@@ -4416,6 +4434,8 @@ export default class MainScene extends Scene {
break;
}
this.changeGroGrass(grassArr);
}
//播放音乐
for(var a = 0; a < sounds.length; a++) {
......@@ -5127,6 +5147,7 @@ export default class MainScene extends Scene {
}
// console.log("所有可作为左上角的",canusearr,"\n所有位置",allusearr);
var grassArr = new Array();
//原来9*9
while(kuangarr.length<4){
var randkidx = Math.floor(Math.random()*canusearr.length);
......@@ -5169,11 +5190,13 @@ export default class MainScene extends Scene {
if(allhave&&haveele){//所占框都可用
var igrassarr = new Array();
for(var k3=0;k3<kuangidxarr.length;k3++){
var k3kuangidx = kuangidxarr[k3];
var ellat = this.lattices[k3kuangidx];
if(ellat&&Tool.judgeEliminate(ellat)){
igrassarr.push(k3kuangidx);
if(this.eliminatedElements.indexOf(k3kuangidx)==-1){
this.eliminatedElements.push(k3kuangidx);
}
......@@ -5194,6 +5217,7 @@ export default class MainScene extends Scene {
canusearr.splice(k3caninuse,1);
}
}
grassArr.push(igrassarr);
kuangarr.push(k1idx);
}
}
......@@ -5232,6 +5256,8 @@ export default class MainScene extends Scene {
}.bind(this));
}
}
this.checkTurfing(grassArr);
}
playCompleteJio(e){
// console.log("猩猩脚印播放完毕");
......@@ -5902,4 +5928,12 @@ export default class MainScene extends Scene {
// }
}
}
//判断草坪能否蔓延
judgeTurfing(idx:number){
if(this.turfingArr.indexOf(idx)!=-1){
return true;
}
return Tool.judgeTurfing(this.lattices[idx]);
}
}
\ No newline at end of file
......@@ -19,22 +19,30 @@ export default async (thisObj: MainScene) => {
thisObj.eliminatedElements.push(lattice.index);
}
}
for (const index of indexs) {
const lat: Lattice = thisObj.lattices[index];
let canturgrass = Tool.judgeTurfing(lat);
let grassArr = new Array();
lat.element['fish'].toExplose();
// wait(1000).then(()=>{
const p = Tool.getPositionByIndex(index);
var boomAni = thisObj.playAni(RecoverName.BOOM_ANI, p);
boomAni.scaleX = boomAni.scaleY = 1;
// });
// });
for (var i = 0; i < thisObj.lattices.length; i++) {
if (Tool.judgeEliminate(thisObj.lattices[i]) &&
(Math.abs(thisObj.lattices[i].row - lat.row) < 2 && Math.abs(thisObj.lattices[i].column - lat.column) < 2)) {
if (thisObj.eliminatedElements.indexOf(thisObj.lattices[i].index) < 0) {
if(canturgrass&&Tool.judgeTurfto(thisObj.lattices[i])){
grassArr.push(i);
}
thisObj.eliminatedElements.push(thisObj.lattices[i].index);
}
}
}
thisObj.changeGroGrass(grassArr);
}
await wait(500);
......
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