MonsterCurveData.java 806 Bytes
Newer Older
Melledy's avatar
Melledy committed
1
package emu.grasscutter.data.excels;
Melledy's avatar
Melledy committed
2
3
4
5
6

import java.util.HashMap;
import java.util.Map;
import java.util.stream.Stream;

7
import emu.grasscutter.data.GameResource;
Melledy's avatar
Melledy committed
8
9
10
11
import emu.grasscutter.data.ResourceType;
import emu.grasscutter.data.common.CurveInfo;

@ResourceType(name = "MonsterCurveExcelConfigData.json")
12
public class MonsterCurveData extends GameResource {
Melledy's avatar
Melledy committed
13
14
	private int level;
    private CurveInfo[] curveInfos;
Melledy's avatar
Melledy committed
15
    
Melledy's avatar
Melledy committed
16
    private Map<String, Float> curveInfoMap;
Melledy's avatar
Melledy committed
17
18
19
	
	@Override
	public int getId() {
Melledy's avatar
Melledy committed
20
		return level;
Melledy's avatar
Melledy committed
21
22
23
	}
	
	public float getMultByProp(String fightProp) {
Melledy's avatar
Melledy committed
24
		return curveInfoMap.getOrDefault(fightProp, 1f);
Melledy's avatar
Melledy committed
25
26
27
28
	}

	@Override
	public void onLoad() {
Melledy's avatar
Melledy committed
29
30
		this.curveInfoMap = new HashMap<>();
		Stream.of(this.curveInfos).forEach(info -> this.curveInfoMap.put(info.getType(), info.getValue()));
Melledy's avatar
Melledy committed
31
32
	}
}