任务:宝石相关任务系统达成条件修改

This commit is contained in:
luying
2022-10-08 16:03:21 +08:00
parent d1766a33a5
commit c064341bc1
5 changed files with 75 additions and 70 deletions
+56 -52
View File
@@ -569,11 +569,11 @@ export class CheckSingleTask {
}
case TASK_TYPE.ROLE_SCHOOL_PUT_HERO: // 18. 百家学宫放置x个武将
{
let { hid, preHid } = param;
if (hid > 0 && preHid <= 0) { // 放置
result = { inc: 1 };
} else if (hid <= 0 && preHid > 0) { // 卸下
result = { inc: -1 };
let records = await getRecord();
let { hid } = param;
if(records.indexOf(`${hid}`) == -1) {
records.push(`${hid}`)
result = { records, inc: 1 };
}
break;
}
@@ -987,28 +987,34 @@ export class CheckSingleTask {
}
case TASK_TYPE.EQUIP_PUT_JEWEL: // 88. x件装备镶嵌X阶天晶石
{
let { oldEquip, newEquip, jewels } = param;
let { oldJewel, newJewel } = getJewelByEquip(oldEquip, newEquip, jewels);
let oldLv = gameData.jewel.get(oldJewel?.id)?.lv || 0;
let lv = gameData.jewel.get(newJewel?.id)?.lv || 0;
if(lv >= dicTaskParam[1] && oldLv < dicTaskParam[1]) {
result = { inc: 1 };
} else if (lv < dicTaskParam[1] && oldLv >= dicTaskParam[1]) {
result = { inc: -1 };
let { hid, newEquip, jewels } = param;
if(!newEquip) break;
let jewel = getJewelByEquip(newEquip, jewels);
let lv = gameData.jewel.get(jewel?.id)?.lv || 0;
if(lv < dicTaskParam[1]) break;
let records = await getRecord();
if(records.indexOf(`${hid}_${newEquip.id}`) == -1) {
records.push(`${hid}_${newEquip.id}`)
result = { records, inc: 1 };
}
break;
}
case TASK_TYPE.EQUIP_PUT_STONE: // 89. x件装备镶嵌X个地玉石
{
let { oldEquip, newEquip } = param;
let oldStoneCnt = oldEquip.stones.filter(cur => cur.stone != 0).length;
let { hid, newEquip } = param;
if(!newEquip) break;
let newStoneCnt = newEquip.stones.filter(cur => cur.stone != 0).length;
if(oldStoneCnt < dicTaskParam[1] && newStoneCnt >= dicTaskParam[1]) {
result = { inc: 1 };
} else if (oldStoneCnt >= dicTaskParam[1] && newStoneCnt < dicTaskParam[1]) {
result = { inc: -1 };
if(newStoneCnt < dicTaskParam[1]) break;
let records = await getRecord();
if(records.indexOf(`${hid}_${newEquip.id}`) == -1) {
records.push(`${hid}_${newEquip.id}`);
result = { records, inc: 1 };
}
break;
}
case TASK_TYPE.EQUIP_STAR_UP_TO: // 90. x件装备升至X星
@@ -1117,23 +1123,26 @@ export class CheckSingleTask {
}
case TASK_TYPE.EQUIP_PUT_JEWEL_CNT: // 99. X件装备镶嵌天晶
{
let { oldEquip, newEquip } = param;
if(oldEquip.jewel && !newEquip.jewel) {
result = { inc: -1 };
} else if (!oldEquip.jewel && newEquip.jewel) {
result = { inc: 1 };
let { newEquip } = param;
if(!newEquip || !newEquip.jewel) break;
let records = await getRecord();
if(records.indexOf(`${newEquip.jewel}`) == -1) {
records.push(`${newEquip.jewel}`);
result = { records, inc: 1 };
}
break;
}
case TASK_TYPE.EQUIP_PUT_STONE_CNT: // 100. X件装备镶嵌地玉
{
let { oldEquip, newEquip } = param;
let oldStoneCnt = oldEquip.stones.filter(cur => cur.stone != 0).length;
let { hid, newEquip } = param;
if(newEquip) break;
let newStoneCnt = newEquip.stones.filter(cur => cur.stone != 0).length;
if(oldStoneCnt > 0 && newStoneCnt == 0) {
result = { inc: -1 };
} else if (oldStoneCnt == 0 && newStoneCnt > 0) {
result = { inc: 1 };
if(newStoneCnt <= 0) break;
let records = await getRecord();
if(records.indexOf(`${hid}_${newEquip.id}`) == -1) {
records.push(`${hid}_${newEquip.id}`);
result = { records, inc: 1 };
}
break;
}
@@ -1147,43 +1156,38 @@ export class CheckSingleTask {
}
case TASK_TYPE.EQUIP_STONE_CNT_LV: // 102. X件装备镶嵌X个大于等于X阶地玉
{
let { oldEquip, newEquip } = param;
let oldStoneLvs = oldEquip.stones.map(cur => {
let dicStone = gameData.stone.get(cur.stone);
return dicStone?dicStone.lv: 0;
});
let { hid, newEquip } = param;
if(!newEquip) break;
let newStoneLvs = newEquip.stones.map(cur => {
let dicStone = gameData.stone.get(cur.stone);
return dicStone?dicStone.lv: 0;
});
let oldCount = oldStoneLvs.filter(lv => lv >= dicTaskParam[2]).length;
let newCount = newStoneLvs.filter(lv => lv >= dicTaskParam[2]).length;
if(oldCount < dicTaskParam[1] && newCount >= dicTaskParam[1]) {
result = { inc: 1 };
} else if (oldCount >= dicTaskParam[1] && newCount < dicTaskParam[1]) {
result = { inc: -1 }
if(newCount < dicTaskParam[1]) break;
let records = await getRecord();
if(records.indexOf(`${hid}_${newEquip.id}`) == -1) {
records.push(`${hid}_${newEquip.id}`);
result = { records, inc: 1 };
}
break;
}
case TASK_TYPE.EQUIP_JEWEL_RANDSE_CNT: // 103.X个天晶的Y条特性词条被激活
{
let { oldEquip, newEquip, jewels } = param;
let { oldJewel, newJewel } = getJewelByEquip(oldEquip, newEquip, jewels);
let oldRandSe = oldJewel?.randSe||[];
let oldUnlockSeCnt = oldRandSe.filter(se => {
return isRandSeUnLock(oldJewel.id, se.id, oldEquip.stones);
}).length;
let { newEquip, jewels } = param;
let newJewel = getJewelByEquip(newEquip, jewels);
if(!newJewel) break;
let newRandSe = newJewel?.randSe||[];
let newUnlockSeCnt = newRandSe.filter(se => {
return isRandSeUnLock(newJewel.id, se.id, newEquip.stones);
}).length;
if(oldUnlockSeCnt < dicTaskParam[1] && newUnlockSeCnt >= dicTaskParam[1]) {
result = { inc: 1 };
} else if (oldUnlockSeCnt >= dicTaskParam[1] && newUnlockSeCnt < dicTaskParam[1]) {
result = { inc: -1 };
if(newUnlockSeCnt < dicTaskParam[1]) break;
let records = await getRecord();
if(records.indexOf(`${newJewel.seqId}`)) {
records.push(`${newJewel.seqId}`);
result = { records, inc: 1 };
}
break;
}