Commit 743c55a1 authored by Edwise's avatar Edwise 🍷

Merge remote-tracking branch 'refs/remotes/origin/jiaoneiqunuan' into jiaoneiqunuan

parents 2ef6cd16 9e93f972
...@@ -230,7 +230,7 @@ Page({ ...@@ -230,7 +230,7 @@ Page({
}, 4000); }, 4000);
}, },
//新ai逻辑,tool==使用道具,task==任务,invite==邀请人 //新ai逻辑,tool==使用道具,task==任务,invite==邀请人
async newAiControl(type = "tool", ainum = 1) { async newAiControl(type = "tool", ainum = 1,aiwarm=0) {
let canwin = this.data.canwin; let canwin = this.data.canwin;
let roomnums = this.data.roomnums - 1; let roomnums = this.data.roomnums - 1;
let roomdata = this.data.roomdata; let roomdata = this.data.roomdata;
...@@ -243,15 +243,15 @@ Page({ ...@@ -243,15 +243,15 @@ Page({
let fromedir = Math.random(); let fromedir = Math.random();
if (fromedir < 0.5) { if (fromedir < 0.5) {
for (let i = 0; i < roomdata.length; i++) { for (let i = 0; i < roomdata.length; i++) {
havechao = this.newAiControl1(i, canwin, roomnums, roomdata, myidx, mywd, havechao, type, ainum); havechao = this.newAiControl1(i, canwin, roomnums, roomdata, myidx, mywd, havechao, type, ainum,aiwarm);
} }
} else { } else {
for (let i = roomdata.length - 1; i > -1; i--) { for (let i = roomdata.length - 1; i > -1; i--) {
havechao = this.newAiControl1(i, canwin, roomnums, roomdata, myidx, mywd, havechao, type, ainum); havechao = this.newAiControl1(i, canwin, roomnums, roomdata, myidx, mywd, havechao, type, ainum,aiwarm);
} }
} }
}, },
newAiControl1(i, canwin, roomnums, roomdata, myidx, mywd, havechao, type = "tool", ainum = 1) { newAiControl1(i, canwin, roomnums, roomdata, myidx, mywd, havechao, type = "tool", ainum = 1,aiwarm=0) {
if (i == myidx) { if (i == myidx) {
} else { } else {
...@@ -273,10 +273,12 @@ Page({ ...@@ -273,10 +273,12 @@ Page({
if (chawd + taskwarm < 0) { if (chawd + taskwarm < 0) {
let maxadd = Math.floor((-1 - chawd) / taskwarm); let maxadd = Math.floor((-1 - chawd) / taskwarm);
if (maxadd > 0) { if (maxadd > 0) {
let addwarm = maxadd*toolwarm;
if (maxadd > ainum) { if (maxadd > ainum) {
maxadd = ainum; maxadd = ainum;
addwarm = aiwarm
} }
cando.push(["task", Math.round(Math.random() * maxadd)]); cando.push(["task", Math.round(Math.random() * maxadd),addwarm]);
} }
} }
...@@ -322,10 +324,12 @@ Page({ ...@@ -322,10 +324,12 @@ Page({
if (type == "task") { if (type == "task") {
let chatask = (1 - chawd); let chatask = (1 - chawd);
let chanum = Math.floor(chatask / taskwarm); let chanum = Math.floor(chatask / taskwarm);
let addchawarm = chanum*taskwarm;
if (chanum > ainum) { if (chanum > ainum) {
chanum = ainum; chanum = ainum;
addchawarm = aiwarm;
} }
let tonum = chanum * taskwarm + iwd; let tonum = addchawarm + iwd;
if (tonum <= mywd) { if (tonum <= mywd) {
let randivite1 = Math.round(Math.random() * 1) + 1 + Math.ceil((mywd - tonum) / invitewarm); let randivite1 = Math.round(Math.random() * 1) + 1 + Math.ceil((mywd - tonum) / invitewarm);
if (randivite1 > 0) { if (randivite1 > 0) {
...@@ -333,7 +337,7 @@ Page({ ...@@ -333,7 +337,7 @@ Page({
} }
} }
if (chanum > 0) { if (chanum > 0) {
bido.push(["task", chanum]); bido.push(["task", chanum,addchawarm]);
} }
} }
if (type == "invite") { if (type == "invite") {
...@@ -380,6 +384,7 @@ Page({ ...@@ -380,6 +384,7 @@ Page({
addOneAiWarm(data, i) { addOneAiWarm(data, i) {
let type = data[0]; let type = data[0];
let nums = data[1]; let nums = data[1];
let aiwarm = data[2];
let othername = this.data.othername; let othername = this.data.othername;
if (type == "tool") { if (type == "tool") {
let itxt = othername[i] + "使用道具一次获得了" + toolwarm + "温度值"; let itxt = othername[i] + "使用道具一次获得了" + toolwarm + "温度值";
...@@ -389,7 +394,13 @@ Page({ ...@@ -389,7 +394,13 @@ Page({
inwd += toolwarm; inwd += toolwarm;
this.updateRolewd(i + 1, inwd); this.updateRolewd(i + 1, inwd);
} else if (type == "task") { } else if (type == "task") {
let itxt = othername[i] + "完成了" + nums + "个任务,获得了" + taskwarm * nums + "温度值"; let addwarm = 0;
if(aiwarm){
addwarm = aiwarm;
}else{
addwarm = taskwarm*nums;
}
let itxt = othername[i] + "完成了" + nums + "个任务,获得了" + addwarm + "温度值";
this.addAttionTxt(itxt); this.addAttionTxt(itxt);
let inroomidx = i; let inroomidx = i;
let inwd = this.data.roomdata[inroomidx]["wd"]; let inwd = this.data.roomdata[inroomidx]["wd"];
...@@ -892,7 +903,7 @@ Page({ ...@@ -892,7 +903,7 @@ Page({
} }
} }
if (taskcount > 0 && taskwarm > 0) { if (taskcount > 0 && taskwarm > 0) {
this.newAiControl("task", taskcount); this.newAiControl("task", taskcount,taskwarm);
let tasktxt = "你完成了" + taskcount + "个任务,获得了" + taskwarm + "温度值"; let tasktxt = "你完成了" + taskcount + "个任务,获得了" + taskwarm + "温度值";
this.addAttionTxt(tasktxt); this.addAttionTxt(tasktxt);
} }
......
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