# Conflicts:
#	conf/server/OptionConfig.txt
back_recharge
jiahuiwen 2019-03-23 17:15:30 +08:00
commit 81a603e0dc
20 changed files with 357 additions and 299 deletions

View File

@ -35,11 +35,17 @@ public class MongoUpdateCache {
Map.Entry<String, UpdateRequest> entry = it.next();
String key1 = entry.getKey();
if(!fullKey.equals(key1)){
//解决类似 item.1 item.11 问题
if (fullKey.contains(key1)) {
return;
if(checkOverride(key1,fullKey)){
return;
}
continue;
}
if (key1.contains(fullKey)) {
it.remove();
if(checkOverride(key1,fullKey)){
it.remove();
}
}
}
@ -49,6 +55,15 @@ public class MongoUpdateCache {
listRequest.put(fullKey, request);
}
public boolean checkOverride(String key1,String key2){
String[] fullKeyArray = key1.split(".");
String[] key1Array = key2.split(".");
if(fullKeyArray.length == key1Array.length && !fullKeyArray[fullKeyArray.length -1].equals(key1Array[key1Array.length -1])){
return false;
}
return true;
}
protected void update(LjsdMongoTemplate ljsdMongoTemplate) throws IllegalAccessException {

View File

@ -1,7 +1,7 @@
Id OpenLevel RecommendForce RecommendHeroIds MinNum BaseRewardGroup RandomRewardGroup RecommendRewardGroup
int int int mut,int#int,1 int mut,int#int,1 mut,int#int,1 mut,int#int,1
1 101001 1000 3#1#2 5 101 1001#1002 2001#2002#2003
2 102001 2000 3#1#2 5 102 1001#1002 2001#2002#2003
3 102001 3000 3#1#2 5 103 1001#1002 2001#2002#2003
4 102001 4000 3#1#2 5 104 1001#1002 2001#2002#2003
5 102001 5000 3#1#2 5 105 1001#1002 2001#2002#2003
int int int mut,int#int,1 int mut,int#int,1 mut,int#int,1 mut,int#int,2
1 101001 1000 2#1#2 5 101 111 2001#2002#2003|2001#2002#2003
2 102001 2000 2#1#2 5 102 112 2001#2002#2003|2001#2002#2003
3 102001 3000 2#1#2 5 103 113 2001#2002#2003|2001#2002#2003
4 102001 4000 2#1#2 5 104 114 2001#2002#2003|2001#2002#2003
5 102001 5000 2#1#2 5 105 115 2001#2002#2003|2001#2002#2003

View File

@ -1,6 +1,6 @@
Id ItemId Chance GrowChance RandomMin RandomMax
int int int float int int
100 3001 0 1.0 0 0
100 3001 1 1.0 0 0
101 3001 100 1.0 1 1
102 3002 100 1.0 1 1
103 3003 100 1.0 1 1

View File

@ -662,93 +662,93 @@ int mut,float#float,2 mut,int#int,2 mut,float#float,2 float
500108 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 1.0
500109 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 1.0
500110 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 1.0
500201 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 2.0
500202 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 2.0
500203 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 2.0
500204 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 2.0
500205 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 2.0
500206 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 2.0
500207 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 2.0
500208 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 2.0
500209 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 2.0
500210 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 2.0
500301 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 3.0
500302 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 3.0
500303 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 3.0
500304 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 3.0
500305 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 3.0
500306 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 3.0
500307 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 3.0
500308 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 3.0
500309 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 3.0
500310 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 3.0
500401 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 4.0
500402 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 4.0
500403 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 4.0
500404 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 4.0
500405 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 4.0
500406 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 4.0
500407 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 4.0
500408 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 4.0
500409 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 4.0
500410 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 4.0
500501 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 5.0
500502 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 5.0
500503 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 5.0
500504 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 5.0
500505 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 5.0
500506 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 5.0
500507 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 5.0
500508 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 5.0
500509 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 5.0
500510 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 5.0
500601 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 6.0
500602 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 6.0
500603 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 6.0
500604 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 6.0
500605 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 6.0
500606 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 6.0
500607 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 6.0
500608 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 6.0
500609 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 6.0
500610 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 6.0
500701 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 7.0
500702 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 7.0
500703 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 7.0
500704 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 7.0
500705 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 7.0
500706 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 7.0
500707 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 7.0
500708 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 7.0
500709 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 7.0
500710 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 7.0
500801 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 8.0
500802 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 8.0
500803 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 8.0
500804 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 8.0
500805 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 8.0
500806 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 8.0
500807 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 8.0
500808 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 8.0
500809 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 8.0
500810 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 8.0
500901 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 9.0
500902 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 9.0
500903 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 9.0
500904 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 9.0
500905 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 9.0
500906 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 9.0
500907 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 9.0
500908 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 9.0
500909 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 9.0
500910 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 9.0
501001 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 10.0
501002 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 10.0
501003 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 10.0
501004 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 10.0
501005 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 10.0
501006 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 10.0
501007 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 10.0
501008 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 10.0
501009 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 10.0
501010 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 10.0
500201 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 2
500202 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 2
500203 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 2
500204 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 2
500205 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 2
500206 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 2
500207 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 2
500208 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 2
500209 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 2
500210 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 2
500301 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 3
500302 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 3
500303 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 3
500304 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 3
500305 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 3
500306 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 3
500307 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 3
500308 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 3
500309 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 3
500310 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 3
500401 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 4
500402 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 4
500403 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 4
500404 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 4
500405 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 4
500406 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 4
500407 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 4
500408 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 4
500409 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 4
500410 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 4
500501 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 5
500502 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 5
500503 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 5
500504 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 5
500505 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 5
500506 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 5
500507 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 5
500508 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 5
500509 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 5
500510 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 5
500601 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 6
500602 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 6
500603 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 6
500604 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 6
500605 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 6
500606 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 6
500607 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 6
500608 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 6
500609 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 6
500610 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 6
500701 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 7
500702 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 7
500703 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 7
500704 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 7
500705 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 7
500706 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 7
500707 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 7
500708 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 7
500709 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 7
500710 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 7
500801 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 8
500802 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 8
500803 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 8
500804 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 8
500805 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 8
500806 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 8
500807 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 8
500808 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 8
500809 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 8
500810 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 8
500901 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 9
500902 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 9
500903 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 9
500904 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 9
500905 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 9
500906 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 9
500907 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 9
500908 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 9
500909 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 9
500910 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 9
501001 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 10
501002 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 10
501003 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 10
501004 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 10
501005 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 10
501006 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 10
501007 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 10
501008 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 10
501009 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 10
501010 20012#0.7|10014#0.7 26#27|25 600|100#4|2#0.1#4 10

View File

@ -25,14 +25,62 @@ local Random = Random
local _fightData
local _optionData
function PrintTable(tb)
local function newPairs(tbl, func)
if func == nil then
return pairs(tbl)
end
local ary = {}
local lastUsed = 0
for key --[[, val--]] in pairs(tbl) do
if (lastUsed == 0) then
ary[1] = key
else
local done = false
for j=1,lastUsed do -- 进行插入排序
if (func(key, ary[j]) == true) then
arrayInsert( ary, key, j )
done = true
break
end
end
if (done == false) then
ary[lastUsed + 1] = key
end
end
lastUsed = lastUsed + 1
end
-- 定义并返回迭代器
local i = 0
local iter = function ()
i = i + 1
if ary[i] == nil then
return nil
else
return ary[i], tbl[ary[i]]
end
end
return iter
end
local function PrintTable(tb)
local indent_str = "{"
for k,v in pairs(tb) do
indent_str = string.format("%s%s=%s", indent_str,
type(k) == "number" and string.format("[%d]",k) or tostring(k),
type(v) == "table" and "" or tostring(v)..",")
for k=1, #tb do
local v = tb[k]
if type(v) == "table" then
indent_str = indent_str .. PrintTable(v)
else
indent_str = indent_str .. tostring(v)..","
end
end
for k,v in newPairs(tb) do
if type(k) ~= "number" then
if type(v) == "table" then
indent_str = string.format("%s%s=%s", indent_str, tostring(k), PrintTable(v))
else
indent_str = string.format("%s%s=%s", indent_str, tostring(k), tostring(v)..",")
end
end
end
indent_str = indent_str .. "},"
@ -48,19 +96,36 @@ local function error( err )
os.date("%H"),
os.date("%M"),
os.date("%S"))
local file = io.open("LogError/"..time..".txt", "a")
file:write("fightData:\n"..PrintTable(_fightData).."\n")
file:write("optionData:\n"..PrintTable(_optionData).."\n")
local file = io.open("luafight/LogError/"..time..".txt", "a")
--file:write("fightData:\n"..PrintTable(_fightData).."\n")
--file:write("optionData:\n"..PrintTable(_optionData).."\n")
file:write("error:\n"..debug.traceback(err).."\n")
io.close(file)
end
local function generateRecordFile()
local time = string.format("%d-%d-%d-%d-%d-%d",
os.date("%Y"),
os.date("%m"),
os.date("%d"),
os.date("%H"),
os.date("%M"),
os.date("%S"))
local file = io.open("luafight/BattleRecord/"..time..".txt", "a")
local record = BattleLogic.GetRecord()
for i=1, #record do
file:write(record[i].."\n")
end
io.close(file)
end
function BattleMain.Execute(seed, fightData, optionData)
_fightData = fightData
_optionData = optionData
print(PrintTable(fightData))
--该开关用于输出战斗过程中的日志,用于验证前后端是否出现战斗不同步
BattleLogic.IsOpenBattleRecord = false
BattleLogic.IsOpenBattleRecord = true
if xpcall(function ()
Random.SetSeed(seed)
@ -86,7 +151,7 @@ function BattleMain.Execute(seed, fightData, optionData)
resultList.result = BattleLogic.Result
if BattleLogic.IsOpenBattleRecord then
BattleLogic.GenerateRecordFile()
generateRecordFile()
end
-- print -----------------------------------------
@ -95,9 +160,12 @@ function BattleMain.Execute(seed, fightData, optionData)
--end
--print("最终运行帧数:"..BattleLogic.CurFrame())
--print("result:"..BattleLogic.Result)
return resultList
end
return { result = -1 }
end
--BattleMain.Execute(1553167956, {playerData={{professionId=3,passivity={},type=1,skill={0,{40001,0.7,{1,2.3,2,},},{30011,0.7,{4,9,0.2,4,1,},{4,10,0.2,4,1,},},},superSkill={1.6,{20211,0.7,{1,3.3,2,},{15,1.98,2,1.98,},},},roleId=10022,camp=0,property={1,1676,1678,248,167,200,173,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=5,passivity={},type=1,skill={0,{40001,0.7,{11,0.93,2,2,0.2,},},},superSkill={3,{20000,0.7,{2,1.06,2,},{3,0.6,1,4,},},},roleId=10008,camp=0,property={1,2206,2208,221,193,232,130,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=4,passivity={},type=1,skill={0,{40001,0.7,{1,1.35,2,},},{30011,0.7,{3,0,0,5,},},},superSkill={2.5,{20000,0.7,{14,1.55,2,1,10023,0.2,},},},roleId=10023,camp=0,property={1,1439,1441,284,131,157,168,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=1,passivity={},type=1,skill={0,{40001,0.7,{1,1,1,},},{30011,0.7,{4,9,0.1,5,1,},{4,10,0.1,5,1,},},},superSkill={2.3,{20312,0.7,{19,1.35,1,0.5,5,},},},roleId=10013,camp=0,property={1,1678,1680,246,194,162,163,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=3,passivity={},type=1,skill={0,{40001,0.7,{1,2.3,2,},},{30011,0.7,{4,9,0.2,4,1,},{4,10,0.2,4,1,},},},superSkill={1.6,{20211,0.7,{1,3.3,2,},{15,1.98,2,1.98,},},},roleId=10022,camp=0,property={17,2732,2734,401,272,326,308,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},teamSkill={},},enemyData={{{professionId=0,passivity={},type=2,skill={0,{20013,0.7,{1,0.45,1,},},},superSkill={},roleId=1,camp=1,property={0,483,483,260,61,61,240,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=0,passivity={},type=2,skill={0,{20013,0.7,{1,0.45,1,},},},superSkill={},roleId=2,camp=1,property={0,483,483,260,61,61,80,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=0,passivity={},type=2,skill={0,{20013,0.7,{1,0.45,1,},},},superSkill={},roleId=3,camp=1,property={0,483,483,260,61,61,7,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},teamSkill={},},},})
--BattleMain.Execute(1553167956, {playerData={{professionId=4,passivity={},type=1,skill={0,{40001,0.7,{1,1.35,2,},},{30011,0.7,{3,0,0,5,},},},superSkill={2.5,{20000,0.7,{14,1.55,2,1,10023,0.2,},},},roleId=10023,camp=0,property={1,1439,1441,284,131,157,168,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=3,passivity={},type=1,skill={0,{40001,0.7,{1,2.3,2,},},{30011,0.7,{4,9,0.2,4,1,},{4,9,0.2,4,1,},},},superSkill={1.6,{20211,0.7,{1,3.3,2,},{15,1.98,2,1.98,},},},roleId=10022,camp=0,property={1,1676,1678,248,167,200,173,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=2,passivity={},type=1,skill={0,{40001,0.7,{1,1.05,2,},{4,4,5,5,3,},},},superSkill={2.3,{20000,0.7,{2,1.89,2,},},{20012,0.7,{3,1,5,5,},},},roleId=10021,camp=0,property={1,1920,1922,209,170,204,178,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=5,passivity={},type=1,skill={0,{40001,0.7,{11,0.93,2,2,0.2,},},},superSkill={3,{20000,0.7,{2,1.06,2,},{3,0.6,1,4,},},},roleId=10008,camp=0,property={1,2206,2208,221,193,232,130,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=1,passivity={},type=1,skill={0,{40001,0.7,{1,1,1,},},{30011,0.7,{4,9,0.1,5,1,},{4,9,0.1,5,1,},},},superSkill={2.3,{20312,0.7,{19,1.35,1,0.5,5,},},},roleId=10013,camp=0,property={1,1678,1680,246,194,162,163,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},teamSkill={{3,{20012,0.7,{26,600,},{27,100,4,},},{10014,0.7,{25,2,0.1,4,},},},},},enemyData={{{professionId=0,passivity={},type=2,skill={0,{20011,0.7,{1,1,1,},{3,0.3,1,3,},},},superSkill={},roleId=14,camp=1,property={0,772,772,260,61,61,80,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,2,2,},quality=1,},{professionId=0,passivity={},type=2,skill={0,{20013,0.7,{1,0.45,1,},},},superSkill={},roleId=1,camp=1,property={0,483,483,260,61,61,240,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=0,passivity={},type=2,skill={0,{20013,0.7,{1,0.45,1,},},},superSkill={},roleId=3,camp=1,property={0,483,483,260,61,61,7,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},teamSkill={},},},})
return BattleMain

View File

@ -42,30 +42,18 @@ function Buff.Create(caster, type, duration, ...)
return buff
end
local queuePool = BattleObjectPool.New(function ()
return BattleQueue.New()
end)
local dicPool = BattleObjectPool.New(function ()
return BattleDictionary.New()
end)
BuffManager = {}
BuffManager.__index = BuffManager
function BuffManager.New()
local instance = {owner=0, buffQueue = queuePool:Get(), buffList = dicPool:Get()}
local instance = {owner=0, buffQueue = BattleQueue.New(), buffList = BattleDictionary.New()}
setmetatable(instance, BuffManager)
return instance
end
function BuffManager:Init(owner)
self.owner = owner
end
function BuffManager:Dispose(owner)
self.buffQueue:Clear()
self.buffList:Clear()
queuePool:Put(self.buffQueue)
dicPool:Put(self.buffList)
self.owner = owner
end

View File

@ -245,12 +245,13 @@ local effectList = {
local f1 = args[1]
local dt = args[2]
local f2 = args[3]
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval)
if caster.camp == 0 and target.camp == 1 then
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
end
BattleLogic.WaitForTrigger(interval, function ()
local dmg = BattleUtil.CalDamage(caster, target, dt, f1)
local dmg, crit = BattleUtil.CalDamage(caster, target, dt, f1)
if target.isDead then
local arr = BattleLogic.Query(function (r) return r.camp ~= caster.camp and r.uid ~= target.uid end)
for i=1, #arr do
@ -314,25 +315,6 @@ local effectList = {
end
end)
end,
--造成[a]%的[b]伤害若暴击则减少下次发动技能CD[c]秒。
--a[float],b[伤害类型],c[float]
[18] = function(caster, target, args, interval)
local f1 = args[1]
local dt = args[2]
local f2 = args[3]
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval)
if caster.camp == 0 and target.camp == 1 then
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
end
BattleLogic.WaitForTrigger(interval, function ()
local d, crit = BattleUtil.CalDamage(caster, target, dt, f1)
if crit then
if target.skill then
target.skill.sp = target.skill.sp + floor(f2 * BattleLogic.GameFrameRate)
end
end
end)
end,
--造成[a]%的[b]伤害,有[c]%的概率追加伤害,最多可追加[d]次。(0无限追加)
--a[float],b[伤害类型],c[float],d[int]
[19] = function(caster, target, args, interval)
@ -486,6 +468,24 @@ local effectList = {
target:AddBuff(Buff.Create(caster, BuffName.DOT, d2, 1, 0, d1, 1))
end)
end,
--造成[a]%的[b]伤害,对[c]造成额外[d]%伤害
--a[float],b[伤害类型,]c[持续伤害状态],d[float]
[28] = function(caster, target, args, interval)
local f1 = args[1]
local dt = args[2]
local dot = args[3]
local f2 = args[4]
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval)
if caster.camp == 0 and target.camp == 1 then
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
end
BattleLogic.WaitForTrigger(interval, function ()
if target.BuffMgr:HasBuff(BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then
f1 = f1 + f2
end
BattleUtil.CalDamage(caster, target, dt, f1)
end)
end,
}
return effectList

View File

@ -2,19 +2,19 @@ local effect = require("Modules/Battle/Logic/Base/Effect")
local floor = math.floor
local max = math.max
local min = math.min
local gameFrameRate = BattleLogic.GameFrameRate
--local BattleConst = BattleConst
--local RoleDataName = RoleDataName
--local BattleEventName = BattleEventName
local chooseList = {}
local function chooseTarget(role, chooseId, exceptList)
local chooseType = floor(chooseId / 10000) % 10
local chooseWeight = floor(chooseId / 100) % 10
local sort = floor(chooseId / 10) % 10
local exceptNum = #exceptList
local exceptNum = exceptList.size
local num = chooseId % 10
local arr = BattleLogic.Query()
local arr
if chooseType == 1 then
arr = BattleLogic.Query(function (r)
for i=1, exceptList.size do
@ -26,8 +26,7 @@ local function chooseTarget(role, chooseId, exceptList)
end)
elseif chooseType == 2 then
if role.lockTarget and num == 1 then
arr[1] = role.lockTarget
return arr
return {role.lockTarget}
end
arr = BattleLogic.Query(function (r)
for i=1, exceptList.size do
@ -38,77 +37,71 @@ local function chooseTarget(role, chooseId, exceptList)
return r.camp ~= role.camp
end)
elseif chooseType == 3 then
arr[1] = role
return arr
return {role}
elseif chooseType == 4 then
return {BattleLogic.GetAggro(role.camp)}
else
arr = BattleLogic.Query()
end
BattleUtil.RandomList(arr)
if chooseWeight == 0 then
BattleUtil.RandomList(arr)
elseif chooseWeight == 1 then
table.sort(arr, function(a, b)
BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.Hp)
local r2 = b:GetRoleData(RoleDataName.Hp)
return sort == 1 and r1 < r2 or r1 > r2
end)
elseif chooseWeight == 2 then
table.sort(arr, function(a, b)
BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.Hp) / a:GetRoleData(RoleDataName.MaxHp)
local r2 = b:GetRoleData(RoleDataName.Hp) / b:GetRoleData(RoleDataName.MaxHp)
return sort == 1 and r1 < r2 or r1 > r2
end)
elseif chooseWeight == 3 then
table.sort(arr, function(a, b)
BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.Attack)
local r2 = b:GetRoleData(RoleDataName.Attack)
return sort == 1 and r1 < r2 or r1 > r2
end)
elseif chooseWeight == 4 then
table.sort(arr, function(a, b)
BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.PhysicalDefence)
local r2 = b:GetRoleData(RoleDataName.PhysicalDefence)
return sort == 1 and r1 < r2 or r1 > r2
end)
elseif chooseWeight == 5 then
table.sort(arr, function(a, b)
BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.PhysicalDefence)
local r2 = b:GetRoleData(RoleDataName.PhysicalDefence)
return sort == 1 and r1 < r2 or r1 > r2
end)
elseif chooseWeight == 6 then
table.sort(arr, function(a, b)
BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.MagicDefence)
local r2 = b:GetRoleData(RoleDataName.MagicDefence)
return sort == 1 and r1 < r2 or r1 > r2
end)
elseif chooseWeight == 7 then
table.sort(arr, function(a, b)
BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.MagicDefence)
local r2 = b:GetRoleData(RoleDataName.MagicDefence)
return sort == 1 and r1 < r2 or r1 > r2
end)
end
for i=1, #chooseList do
chooseList[i] = nil
if exceptNum > 0 then
local count = #arr
for i=1, min(exceptNum, count) do
for j=count, i+1, -1 do
arr[j] = arr[j-1]
end
arr[i] = exceptList.buffer[i]
end
end
--local chooseList = {}
for i=1, exceptNum do
chooseList[i] = exceptList[i]
end
for i=1+exceptNum, num == 0 and #arr or min(#arr, num) do
chooseList[i] = arr[i]
end
arr = chooseList
return arr
end
local effectPool = BattleObjectPool.New(function ()
return {0, {}} -- type, {args, ...}
end)
local effectGroupPool = BattleObjectPool.New(function ()
return { 0, 0, {}} -- chooseId, duration, {effect1, effect2, ...}
end)
Skill = {}
@ -134,11 +127,11 @@ function Skill:Init(role, effectData)
local v
for i=2, #effectData do
v = effectData[i]
local effectGroup = effectGroupPool:Get() -- chooseId, duration, {effect1, effect2, ...}
local effectGroup = { 0, 0, {}} -- chooseId, duration, {effect1, effect2, ...}
effectGroup[1] = v[1] --chooseId
effectGroup[2] = v[2] --duration
for j=3, #v do --effectList
local effect = effectPool:Get() -- type, {args, ...}
local effect = {0, {}} -- type, {args, ...}
effect[1] = v[j][1]
for k=2, #v[j] do
effect[2][k-1] = v[j][k]
@ -149,18 +142,6 @@ function Skill:Init(role, effectData)
end
end
function Skill:Dispose()
local effectGroup
for i=1, self.effectList.size do
effectGroup = self.effectList.buffer[i]
for k=1, #effectGroup[3] do
effectPool:Put(effectGroup[3][k])
effectGroup[3][k] = nil
end
effectGroupPool:Put(effectGroup)
end
end
function Skill:ResetCD()
if not self.isTeamSkill then
if self.owner.superSkill == self then
@ -196,6 +177,12 @@ function Skill:ResetCD()
BattleLogic.SetAggro(self.owner, 0)
end
local function takeEffect(type, caster, target, args, interval)
effect[type](caster, target, args, interval)
if BattleLogic.IsOpenBattleRecord then
BattleLogic.RecordEffect(caster, target, type, args, interval)
end
end
function Skill:Cast()
for i=1, self.effectList.size do
local effectGroup = self.effectList.buffer[i]
@ -217,7 +204,7 @@ function Skill:Cast()
for j=1, #arr do
for k=1, #effectGroup[3] do
local v = effectGroup[3][k]
effect[v[1]](self.owner, arr[j], v[2], duration)
takeEffect(v[1], self.owner, arr[j], v[2], duration)
end
end
elseif chooseId == 20000 then --敌方aoe
@ -225,14 +212,14 @@ function Skill:Cast()
for j=1, #arr do
for k=1, #effectGroup[3] do
local v = effectGroup[3][k]
effect[v[1]](self.owner, arr[j], v[2], duration)
takeEffect(v[1], self.owner, arr[j], v[2], duration)
end
end
elseif nn == 1 or nn == 3 then
for j=1, #arr do
for k=1, #effectGroup[3] do
local v = effectGroup[3][k]
effect[v[1]](self.owner, arr[j], v[2], duration)
takeEffect(v[1], self.owner, arr[j], v[2], duration)
end
end
else
@ -252,7 +239,7 @@ function Skill:Cast()
r = arr[i]
for k=1, #effectGroup[3] do
local v = effectGroup[3][k]
effect[v[1]](self.owner, r, v[2], cd)
takeEffect(v[1], self.owner, r, v[2], cd)
end
return
end
@ -265,7 +252,7 @@ function Skill:Cast()
self.choosedList:Add(r)
for k=1, #effectGroup[3] do
local v = effectGroup[3][k]
effect[v[1]](self.owner, r, v[2], cd)
takeEffect(v[1], self.owner, r, v[2], cd)
end
end)
end

View File

@ -1,10 +1,10 @@
BattleLogic = {}
local floor = math.floor
local min = math.min
local max = math.min
local objList = BattleDictionary.New()
local skillList
local curUid
local curBuffId
local curFrame
@ -14,8 +14,6 @@ local enemyMP
local playerAggro
local enemyAggro
local playerAggroChangable
local enemyAggroChangable
local playerSkillUsable
local enemySkillUsable
@ -74,8 +72,6 @@ function BattleLogic.Init(data, optionData)
BattleLogic.Clear()
skillList = {}
curUid = 0
curBuffId = 0
curFrame = 0
@ -86,9 +82,6 @@ function BattleLogic.Init(data, optionData)
playerTeamSkillIndex = 1
enemyTeamSkillIndex = 1
playerAggroChangable = true
enemyAggroChangable = true
playerSkillUsable = true
enemySkillUsable = true
@ -147,9 +140,9 @@ end
function BattleLogic.AddMP(camp, mp)
if camp == 0 then
playerMP = math.min(playerMP + mp, 100)
playerMP = min(playerMP + mp, 100)
else
enemyMP = math.min(playerMP + mp, 100)
enemyMP = min(playerMP + mp, 100)
end
end
@ -187,24 +180,12 @@ end
function BattleLogic.SetAggro(role, duration)
if role.camp == 1 then
if playerAggroChangable then
playerAggro = role
if enemySkillUsable then
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, role, math.max(duration/2, 0.3))
end
playerAggroChangable = false
BattleLogic.WaitForTrigger(duration-BattleLogic.GameDeltaTime, function () --减去一帧避免卡点
playerAggroChangable = true
end)
playerAggro = role
if enemySkillUsable then
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, role, max(duration/2, 0.3))
end
else
if enemyAggroChangable then
enemyAggro = role
enemyAggroChangable = false
BattleLogic.WaitForTrigger(duration-BattleLogic.GameDeltaTime, function () --减去一帧避免卡点
enemyAggroChangable = true
end)
end
enemyAggro = role
end
end
@ -251,10 +232,15 @@ function BattleLogic.GetSkillUsable(camp)
end
function BattleLogic.WaitForTrigger(delayTime, action)
delayTime = floor(delayTime * 100000 + 0.5) / 100000 --进行精度处理,避免前后端计算不一致
local delayFrame = floor(delayTime * BattleLogic.GameFrameRate + 0.5)
local item = actionPool:Get()
item[1] = curFrame + floor(delayTime * BattleLogic.GameFrameRate + 0.5)
item[1] = curFrame + delayFrame
item[2] = action
tbActionList:Add(item)
if BattleLogic.IsOpenBattleRecord then
BattleLogic.RecordDelayTrigger(delayTime, curFrame + delayFrame)
end
end
function BattleLogic.AddOption(opType, opArg)
@ -283,12 +269,8 @@ function BattleLogic.CurFrame()
return curFrame
end
local list = {}
function BattleLogic.Query(func, inCludeDeadRole)
for i=1, #list do
list[i] = nil
end
--local list = {}
local list = {}
local index = 1
if func then
for i=1, objList.size do
@ -362,9 +344,7 @@ function BattleLogic.Update()
index = 1
while index <= tbActionList.size do
if tbActionList.buffer[index][1] <= curFrame then
if tbActionList.buffer[index][2] then
tbActionList.buffer[index][2]()
end
tbActionList.buffer[index][2]()
actionPool:Put(tbActionList.buffer[index])
tbActionList:Remove(index)
else
@ -460,6 +440,22 @@ function BattleLogic.RecordRoleProperty(uid, camp, name, value, delta)
table.insert(record, string.format("frame:%d, uid:%d, camp:%d, name:%s, value:%d, delta:%d", curFrame, uid, camp, name, value, delta))
end
--Record专用
function BattleLogic.RecordEffect(caster, target, type, args, interval)
local cUid = tostring(caster.uid) or "cTeam"
local tUid = tostring(target.uid) or "tTeam"
local str = ""
for i=1, #args do
str = str..tostring(args[i]) .. (i == #args and "" or "#")
end
table.insert(record, string.format("frame:%d, caster:%s, target:%s, effectType:%d, args:%s, interval:%d", curFrame, cUid, tUid, type, str, interval))
end
--Record专用
function BattleLogic.RecordDelayTrigger(delayFrame, triggerFrame)
table.insert(record, string.format("frame:%d, delayTime:%f, triggerFrame:%d", curFrame, delayFrame, triggerFrame))
end
--Record专用
function BattleLogic.GenerateRecordFile()
local time = string.format("%d-%d-%d-%d-%d-%d",

View File

@ -175,6 +175,18 @@ function BattleUtil.RandomList(arr)
end
end
function BattleUtil.Sort(arr, comp)
if #arr <= 1 then return arr end
for i=1, #arr do
for j = #arr, i+1, -1 do
if comp(arr[j-1], arr[j]) then
arr[j-1], arr[j] = arr[j], arr[j-1]
end
end
end
return arr
end
function BattleUtil.GetPropertyName(type)
if type == 1 then
return RoleDataName.Strength

View File

@ -11,19 +11,10 @@ local Passivity = require("Modules/Battle/Logic/Base/Passivity")
local skillPool = BattleObjectPool.New(function ()
return Skill:New()
end)
local buffPool = BattleObjectPool.New(function ()
return BuffManager.New()
end)
local eventPool = BattleObjectPool.New(function ()
return BattleEvent:New()
end)
local dataPool = BattleObjectPool.New(function ()
return RoleData.New()
end)
function RoleLogic.New()
local instance = {uid=0,roleData=0,data=0,camp=0,name=0,roleType=0,shield=BattleList.New(),exCalDmgList=BattleList.New(),
BuffMgr=0,Event=0,passiveList=0,isDead=false,Auto=false,IsDebug=false,enable=false}
local instance = {uid=0,roleData=0,data=RoleData.New(),camp=0,name=0,roleType=0,shield=BattleList.New(),exCalDmgList=BattleList.New(),
BuffMgr=BuffManager.New(),Event=BattleEvent:New(),passiveList=0,isDead=false,Auto=false,IsDebug=false,enable=false}
setmetatable(instance, RoleLogic)
return instance
end
@ -32,7 +23,6 @@ function RoleLogic:Init(uid, data)
self.uid = uid
self.roleData = data
self.data = dataPool:Get()
self.data:Init(self, data.property)
self.camp = data.camp --阵营 0我方 1敌方
@ -42,10 +32,7 @@ function RoleLogic:Init(uid, data)
self.shield:Clear() --护盾列表
self.exCalDmgList:Clear() --额外计算伤害列表
self.BuffMgr = buffPool:Get()
self.BuffMgr:Init(self)
self.Event = eventPool:Get()
self.Event:ClearEvent()
self.passiveList = {}
@ -84,16 +71,11 @@ function RoleLogic:AddBuff(buff)
end
function RoleLogic:Dispose()
eventPool:Put(self.Event)
dataPool:Put(self.data)
buffPool:Put(self.BuffMgr)
if self.skill then
self.skill:Dispose()
skillPool:Put(self.skill)
self.skill = nil
end
if self.superSkill then
self.superSkill:Dispose()
skillPool:Put(self.superSkill)
self.superSkill = nil
end

View File

@ -26,26 +26,14 @@ public class SAdventureConfig implements BaseConfig {
private int[] randomRewardGroup;
private int[] recommendRewardGroup;
private int pooId;
private Set<Integer> recommendHeroSets;
private int[][] recommendRewardGroup;
@Override
public void init() throws Exception {
Map<Integer, SAdventureConfig> config = STableManager.getConfig(SAdventureConfig.class);
for(SAdventureConfig sAdventureConfig : config.values()){
int[] recommendHeroIds = sAdventureConfig.getRecommendHeroIds();
Set<Integer> recommendHeroSetTmp = new HashSet<>(recommendHeroIds.length);
for(int i=0;i<recommendHeroIds.length;i++){
recommendHeroSetTmp.add(recommendHeroIds[i]);
}
sAdventureConfig.setRecommendHeroSets(recommendHeroSetTmp);
}
sAdventureConfigMap = config;
sAdventureConfigMap = STableManager.getConfig(SAdventureConfig.class);
}
@ -57,14 +45,6 @@ public class SAdventureConfig implements BaseConfig {
return sAdventureConfigMap;
}
public Set<Integer> getRecommendHeroSets() {
return recommendHeroSets;
}
public void setRecommendHeroSets(Set<Integer> recommendHeroSets) {
this.recommendHeroSets = recommendHeroSets;
}
public int getId() {
return id;
}
@ -93,11 +73,8 @@ public class SAdventureConfig implements BaseConfig {
return randomRewardGroup;
}
public int[] getRecommendRewardGroup() {
public int[][] getRecommendRewardGroup() {
return recommendRewardGroup;
}
public int getPooId() {
return pooId;
}
}

View File

@ -57,7 +57,7 @@ public class SSkillLogicConfig implements BaseConfig {
return effect;
}
public int getEffectValueIndex (int[][] effectArr,int value){
public int getEffectValueIndex (int[][] effectArr,int value, int index){
StringBuilder effectStr = new StringBuilder();
for (int[] effects :effectArr){
for (int eff :effects){
@ -73,14 +73,18 @@ public class SSkillLogicConfig implements BaseConfig {
for (int i =0 ; i < ints.length; i++){
map.put(i,ints[i]);
}
int index = 0;
int backIndex = 0;
int flag = 0;
for (Map.Entry<Integer,Integer> entry : map.entrySet()){
if (entry.getValue() == value){
index = entry.getKey();
break;
backIndex = entry.getKey();
if (flag == index){
break;
}
flag++;
}
}
return index;
return backIndex;
}
public float[][] getEffectValue() {
@ -120,7 +124,7 @@ public class SSkillLogicConfig implements BaseConfig {
}else {
effectInfo.append("|").append(effects[i]);
}
int index = getEffectValueIndex(effect, effects[i]);
int index = getEffectValueIndex(effect, effects[i], i );
float[] effectValue = effectValues[index];
for (float effectVal : effectValue) {
effectInfo.append("#").append(effectVal);

View File

@ -33,8 +33,11 @@ public class SVipLevelConfig implements BaseConfig {
for(int[] temp : privileges){
privilegeMap.put(temp[0],temp[1]);
}
sVipLevelConfig.setPrivilegeMap(privilegeMap);
}
}
sVipLevelConfigMap =config;
}
public static Map<Integer, SVipLevelConfig> getsVipLevelConfigMap() {
@ -64,4 +67,8 @@ public class SVipLevelConfig implements BaseConfig {
public Map<Integer, Integer> getPrivilegeMap() {
return privilegeMap;
}
public void setPrivilegeMap(Map<Integer, Integer> privilegeMap) {
this.privilegeMap = privilegeMap;
}
}

View File

@ -718,10 +718,26 @@ public class MapLogic {
LuaValue getOptionData = FightDataUtil.getOptionData(frames);
int[] checkResult = CheckFight.getInstance().checkFight(seed, getFightData, getOptionData);
List<Integer> remainHp = new ArrayList<>(5);
for (int i = 1; i < checkResult.length; i++) {
remainHp.add(checkResult[i]);
}
//校验结果码 1胜利
int resultCode = checkResult[0];
if (resultCode !=1){
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "战斗失败");
if (resultCode == -1){
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "战斗异常!");
return;
}else if(resultCode == 0){
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
FightInfoProto.FightEndResponse fightEndResponse = FightInfoProto.FightEndResponse
.newBuilder()
.setResult(resultCode)
.setDrop(dropBuilder)
.addAllRemainHpList(remainHp)
.build();
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse, true);
return;
}
@ -732,15 +748,11 @@ public class MapLogic {
hero.setCurHp(checkResult[teamPosHeroInfo.getPosition()]);
}
List<Integer> remainHp = new ArrayList<>(5);
for (int i = 1; i < checkResult.length; i++) {
remainHp.add(checkResult[i]);
}
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 1);
FightInfoProto.FightEndResponse fightEndResponse = FightInfoProto.FightEndResponse
.newBuilder()
.setDrop(drop)
.setResult(resultCode)
.addAllRemainHpList(remainHp)
.build();
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse, true);

View File

@ -132,7 +132,8 @@ public class BehaviorUtil {
fightData.addAllMonsterList(monsterGroupList);
//设置战斗随机种子
int seed = (int)(System.currentTimeMillis()/1000);
// int seed = (int)(System.currentTimeMillis()/1000);
int seed = 1553167956;
fightData.setFightSeed(seed);
fightStartRespons.setFightData(fightData);

View File

@ -68,6 +68,7 @@ public class CheckFight {
/**
* 线50ms100线
* http://www.luaj.org/luaj/3.0/examples/jse/SampleMultiThreaded.java
* @param seed
* @param fightData
* @param optionData
@ -83,7 +84,7 @@ public class CheckFight {
if (status==1){
for (int i = 1; i <= result.length(); i++) {
resultCache[i] = result.rawget(i).toint();
LOGGER.info(i+" --> 单位剩余血量 : "+ resultCache[i]);
// LOGGER.info(i+" --> 单位剩余血量 : "+ resultCache[i]);
}
}
return resultCache;

View File

@ -154,8 +154,7 @@ public class CombatLogic {
return;
}
int pooId = sAdventureConfig.getPooId();
SAdventureSetting sAdventureSetting = SAdventureSetting.getsAdventureSetting(pooId);
SAdventureSetting sAdventureSetting = SAdventureSetting.getsAdventureSetting(position);
if(hourDuration > sAdventureSetting.getPerMapMaxHour()){
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_STATION_RESPONSE_VALUE,"超出时长");
return;
@ -173,7 +172,7 @@ public class CombatLogic {
int allowTime =0;
if(!adventureManager.getAllowTimeMap().containsKey(position)){
int vipLevel = user.getPlayerInfoManager().getVipLevel();
allowTime = SVipLevelConfig.getsVipLevelConfigMap().get(vipLevel).getPrivilegeMap().get(vipLevel) -hourDuration;
allowTime = SVipLevelConfig.getsVipLevelConfigMap().get(vipLevel).getPrivilegeMap().get(1) -hourDuration;
}else{
Integer remainAllowTime = adventureManager.getAllowTimeMap().get(position);
allowTime = remainAllowTime - hourDuration;
@ -196,7 +195,7 @@ public class CombatLogic {
HeroManager heroManager = user.getHeroManager();
int myRecommendHeroSize=0;
int totalForce=0;
Set<Integer> recommendHeroSets = sAdventureConfig.getRecommendHeroSets();
Set<Integer> recommendHeroSets =adventureSeasonInfoCache.getRecommendFinalHeroMap().get(position);
Set<Integer> cacheHeroTid = new HashSet<>(recommendHeroSets.size());
for(String heroId : heroIds){
Hero hero = heroManager.getHero(heroId);
@ -208,7 +207,7 @@ public class CombatLogic {
totalForce += HeroLogic.getInstance().calHeoForce(user,hero);
}
adventureManager.station(new AdventureStateInfo(position,heroIds,(int)(System.currentTimeMillis()),hourDuration,totalForce,myRecommendHeroSize),allowTime);
adventureManager.station(new AdventureStateInfo(position,heroIds,(int)(System.currentTimeMillis()/1000),hourDuration,totalForce,myRecommendHeroSize),allowTime);
//发送成功
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ADVENTURE_STATION_RESPONSE_VALUE,null,true);
@ -235,8 +234,8 @@ public class CombatLogic {
SAdventureConfig sAdventureConfig = SAdventureConfig.getsAdventureConfigByPosition(position);
int recommendForce = sAdventureConfig.getRecommendForce();
int pooId = sAdventureConfig.getPooId();
SAdventureSetting sAdventureSetting = SAdventureSetting.getsAdventureSetting(pooId);
SAdventureSetting sAdventureSetting = SAdventureSetting.getsAdventureSetting(position);
float[][] baseRewardRatio = sAdventureSetting.getBaseRewardRatio();
@ -251,13 +250,20 @@ public class CombatLogic {
float baseRewardRatioTmp = calRatio(myForceRatio, baseRewardRatio) * hourRewardRatioTmp;
float randomRewardRatioTmp = calRatio(myForceRatio, randomRewardRatio) * hourRewardRatioTmp;
int[] baseRewardGroup = sAdventureConfig.getBaseRewardGroup();
int[] recommendRewardGroup = sAdventureConfig.getRecommendRewardGroup();
int[][] recommendRewardGroup = sAdventureConfig.getRecommendRewardGroup();
int[] randomRewardGroup = sAdventureConfig.getRandomRewardGroup();
Map<int[],Float> dropInfoMap = new HashMap<>();
dropInfoMap.put(baseRewardGroup,baseRewardRatioTmp);
dropInfoMap.put(randomRewardGroup,randomRewardRatioTmp);
if(myRecommendHeroSize>0){
dropInfoMap.put(new int[]{recommendRewardGroup[myRecommendHeroSize-1]},myRecommendHeroSize*1.0f);
int[] recommendRewardGroupDetail = recommendRewardGroup[myRecommendHeroSize - 1];
for(int i=0;i<recommendRewardGroupDetail.length;i=i+2){
int hourLimit = recommendRewardGroupDetail[i];
if(hourDuration<=hourLimit){
dropInfoMap.put(new int[]{recommendRewardGroupDetail[i+1]},1.0f);
break;
}
}
}
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropInfoMap);
//清除占领

View File

@ -741,6 +741,7 @@ public class HeroLogic {
public int calHeoForce(User user, Hero hero){
Map<Integer, Integer> heroAllAttribute = calHeroFinalAttribute(user, hero);
heroAllAttribute.remove(0);
double result = 0;
for(Map.Entry<Integer, Integer> item : heroAllAttribute.entrySet()){
Integer propertyId = item.getKey();

View File

@ -84,7 +84,8 @@ public class CBean2Proto {
if(adventureStateInfo!=null){
int startTime = adventureStateInfo.getStartTime();
int now = (int)(System.currentTimeMillis()/1000);
builder.setPositionId(adventureStateInfo.getPosition())
builder.addAllHeroIdList(adventureStateInfo.getHeroIds())
.setHourDuration(adventureStateInfo.getHourDuration())
.setRemainTime((now - startTime ));
}
return builder.build();