Commit 17ae0401 authored by zjz1994's avatar zjz1994

草坪暂存

parent 09997e13
......@@ -1941,7 +1941,7 @@ export default class MainScene extends Scene {
// }
var grassArr = new Array();
var canturgrass = this.judgeTurfing(index);
console.log("能够蔓延出去",canturgrass);
// console.log("能够蔓延出去",canturgrass);
//新增石头阻挡
var elimitarr = this.getEliPassCannoStone(rc[0],rc[1]);
for(var j=0;j<elimitarr.length;j++){
......@@ -3478,21 +3478,26 @@ export default class MainScene extends Scene {
// console.log("炮台石头消除");
break;
}
}
if(canturgrass){
if(lat&&lat.element){
if(lat.element.type==ElementType.CANNO&&!lat.grass){
turfCp.push(iemitidx);
}else if(lat.element.type==ElementType.Pongo&&!lat.element.hasState(StateType.PongoLockState)&&!lat.grass){
turfCp.push(iemitidx);
if(canturgrass){
if(lat&&lat.element){
if(lat.element.type==ElementType.CANNO&&!lat.grass){
turfCp.push(iemitidx);
}else if(lat.element.type==ElementType.Pongo&&!lat.element.hasState(StateType.PongoLockState)&&!lat.grass){
turfCp.push(iemitidx);
}
}
if(Tool.judgeTurfto(lat)){
grassArr.push(jemitidx);
}else{
if(!lat.grass){
canturgrass = false;
}
}
}
if(Tool.judgeTurfto(lat)){
grassArr.push(jemitidx);
}else{
canturgrass = false;
}
}
//提前消除了,需要修改成炮台的消除时消除
if(lat&&lat.element){
......@@ -4018,7 +4023,7 @@ export default class MainScene extends Scene {
//添加消除元素two,5*5,需要优化
for(var i = 0; i < this.lattices.length; i++) {
var lat = this.lattices[i];
if(canturgrass&&(Math.abs(lat.row - lat1.row) < 3 && Math.abs(lat.column - lat1.column) < 3)){
if(canturgrass&&lat&&(Math.abs(lat.row - lat1.row) < 3 && Math.abs(lat.column - lat1.column) < 3)){
if(lat&&lat.element){
if(lat.element.type==ElementType.CANNO&&!lat.grass){
turfCp.push(i);
......@@ -4352,7 +4357,7 @@ export default class MainScene extends Scene {
this.recoverEle(index);
//3*3,需要优化
for(var i = 0; i < this.lattices.length; i++) {
if(canturgrass&&Math.abs(this.lattices[i].row - lat.row) < 2 && Math.abs(this.lattices[i].column - lat.column) < 2){
if(canturgrass&&this.lattices[i]&&Math.abs(this.lattices[i].row - lat.row) < 2 && Math.abs(this.lattices[i].column - lat.column) < 2){
if(lat&&lat.element){
if(lat.element.type==ElementType.CANNO&&!lat.grass){
turfCp.push(i);
......@@ -5985,6 +5990,15 @@ export default class MainScene extends Scene {
this.steps += 5;
}, 333)
}
//元素参与消除,不消除直接转特效处理
if(ele){
var eleidx = ele.index;
if(this.turfingArr.indexOf(eleidx)!=-1){
this.turfing(eleidx);
}
}
}
checkTurfing(grassArr:Array<Array<number>>){
......
......@@ -80,6 +80,7 @@ export default async (thisObj: MainScene) => {
const { elementContainer } = thisObj;
const conveyorList = thisObj.chapterData.map.conveyor;
if (!conveyorList) return;
const mapmentsList = [];//轨道地图元素组
const elementsList = []; //所有轨道元素组的列表
const targetLatticesList: Lattice[][] = []; //所有轨道目标地图组的列表
const latticesList:Lattice[][] = []; //所有轨道当前地图组的列表
......@@ -105,6 +106,10 @@ export default async (thisObj: MainScene) => {
}
// console.log(list, targetIndexs);
// const mapments = list.map(index=>
// thisObj.lattices[]
// );
console.log("传送带检查");
const elements = list.map(index =>
thisObj.lattices[index].element
);//当前传送带元素
......
......@@ -33,7 +33,7 @@ export default async (thisObj: MainScene) => {
boomAni.scaleX = boomAni.scaleY = 1;
// });
for (var i = 0; i < thisObj.lattices.length; i++) {
if(canturgrass&&Math.abs(thisObj.lattices[i].row - lat.row) < 2 && Math.abs(thisObj.lattices[i].column - lat.column) < 2){
if(canturgrass&&thisObj.lattices[i]&&Math.abs(thisObj.lattices[i].row - lat.row) < 2 && Math.abs(thisObj.lattices[i].column - lat.column) < 2){
if(lat&&lat.element){
if(lat.element.type==ElementType.CANNO&&!lat.grass){
turfCp.push(i);
......
......@@ -63,7 +63,7 @@ const judgeActionIndex = (index: number, lattices: Lattice[],worms:number[][]):
while (arr.length) {
var rand = Math.floor(Math.random() * arr.length);
var i = arr.splice(rand, 1)[0];
if ((Tool.judgeBaseEle(lattices[i]) &&
if (((Tool.judgeBaseEle(lattices[i]) &&
!lattices[i].element.hasAnyState() &&
!lattices[i].element.candy &&
!lattices[i].sand &&
......@@ -71,10 +71,10 @@ const judgeActionIndex = (index: number, lattices: Lattice[],worms:number[][]):
!lattices[i].ice &&
!lattices[i].grass&&
!lattices[i].element.monster &&
!Tool.judgeInWormHole(i,worms)&&
!lattices[i].grass
!Tool.judgeInWormHole(i,worms)
)||
(lattices[i]&&lattices[i].element&&lattices[i].element.inPongoPart)//猩猩支持流沙
(lattices[i]&&lattices[i].element&&lattices[i].element.inPongoPart))//猩猩支持流沙
&&!lattices[i].grass
) {
return i
}
......
......@@ -27,6 +27,7 @@ const getMapsp = function(lattice:Lattice){
var blockice = lattice.block.ice;
var blockicecout = lattice.block.iceCountNum;
var blockstate = lattice.block.state;
var blockgrass = lattice.block.grass;
mapcf.mapdata["maptype"] = LatticeType.BlOCK;
if(blockice){
......@@ -35,9 +36,17 @@ const getMapsp = function(lattice:Lattice){
}else if(blockicecout==2){
mapcf.mapdata["maptype"] = LatticeType.BLOCK_AND_DARK_ICE;
}
}else if(blockgrass){
mapcf.mapdata["maptype"] = LatticeType.BLOCK_AND_GRASS;
}
mapcf.mapdata["blockstate"] = lattice.block.state;
}else{//无地图元素
}
else if(lattice.grass){
mapcf.mapele = lattice.grass;
mapcf.mapdata["maptype"] = LatticeType.GRASS;
}
else{//无地图元素
}
}
......
......@@ -1318,19 +1318,19 @@ export class Tool {
//判断草坪能否铺出去,炮台铺草坪另算
public static judgeTurfing(lat:Lattice){
if(!lat||!lat.element){
console.log("铺出去111111111111");
// console.log("铺出去111111111111");
return false;
}
if(lat.ice&&lat.ice.alpha!=0){
console.log("铺出去222222222222");
// console.log("铺出去222222222222");
return false;
}
if(lat.block && lat.block.ice && lat.block.canIceBroken && lat.block.ice.alpha!=0) {
console.log("铺出去333333333");
// console.log("铺出去333333333");
return false;
}
if(lat.sand){
console.log("铺出去44444444444");
// console.log("铺出去44444444444");
return false;
}
let ele = lat.element;
......@@ -1341,11 +1341,11 @@ export class Tool {
}else if(ele.type==ElementType.Pongo&&!ele.hasState(StateType.PongoLockState)){
return true;
}
console.log("铺出去55555555555555");
// console.log("铺出去55555555555555");
return false;
}
if(!lat.grass){
console.log("铺出去66666666666666");
// console.log("铺出去66666666666666");
return false;
}
return true;
......@@ -1368,7 +1368,6 @@ export class Tool {
let canChosen = this.judgeChosen(ele);
if(!canChosen){
if(ele.type==ElementType.CANNO){
console.log("炮台可以上草坪");
return true;
}else if(ele.type==ElementType.Pongo&&!ele.hasState(StateType.PongoLockState)){
return true;
......@@ -1380,4 +1379,5 @@ export class Tool {
}
return true;
}
}
\ No newline at end of file
......@@ -4,23 +4,26 @@ import { ChapterData } from "../interface/ChapterData";
export const Chapters28: ChapterData[] = [
//701
{ baseElementTypes: [ 0, 2, 3, 4 ], bubbleProbability: 0, stepCount: 21,
passTarget: { type: 1, elements: [ { type: 9, count: 56 } ] }, starScores: [ 15000, 20000, 25000 ], map: {
passTarget: { type: 1, elements: [ { type: 9, count: 56 } ] }, starScores: [ 15000, 20000, 25000 ], map: {
lattices: [
0, 0, 0, 3, 3, 3, 0, 0, 0,
0, 0, 3, 3, 3, 3, 3, 0, 0,
0, 3, 3, 3, 3, 3, 3, 3, 0,
3, 3, 3, 3, 3, 3, 91, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3,
0, 3, 3, 3, 1, 3, 3, 3, 0,
0, 0, 3, 3, 3, 3, 3, 0, 0,
0, 0, 0, 3, 3, 3, 0, 0, 0 ], connectedLats: [], conveyor: [], conveyorConnectedLats: [], WORMHOLE: [],
0, 0, 0, 1, 1, 1, 0, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 91, 1, 1, 1, 1, 1, 1, 0,
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,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 1, 1, 3, 0, 0, 0 ], connectedLats: [],
conveyor: [ [ 19, 22 ], [ 45, 50 ], [ 75, 77 ] ],
conveyorConnectedLats: [ [ 22, 19 ], [ 50, 45 ], [ 77, 75 ] ],
// WORMHOLE: [[33,11,55,66]],
elements: [
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,
4, 1, 1, 1, 1, 1, 1, 1, 4,
2, 2, 2, 2, 2, 2, 2, 2, 2,
4, 19, 19, 1, 1, 1, 1, 1, 4,
2, 1, 1, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2,
1, 5, 4, 5, 12, 5, 4, 5, 1,
1, 1, 4, 4, 4, 4, 4, 1, 1,
......@@ -36,4 +39,4 @@ export const Chapters28: ChapterData[] = [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0
], recycles: [], generateLats: [ { index: 11, type: null }, { index: 3, type: null }, { index: 13, type: null }, { index: 4, type: null }, { index: 5, type: null }, { index: 19, type: null }, { index: 25, type: null }, { index: 27, type: null }, { index: 35, type: null } ] } },
]
]
......@@ -120,6 +120,7 @@ export class Lattice {
this.block = null;
this.sand = null;
this.element = null;
this.grass = null;
// console.log("交换使用了新数据");
if(mapcf.mapdata["maptype"]){
......@@ -137,6 +138,13 @@ export class Lattice {
case LatticeType.BLOCK_AND_DARK_ICE:
this.block = mapcf.mapele;
break;
case LatticeType.BLOCK_AND_GRASS:
this.block = mapcf.mapele;
this.grass = mapcf.mapele.grass;
break;
case LatticeType.GRASS:
this.grass = mapcf.mapele;
break;
default:
console.error("未定义地图类型,检查");
break;
......
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