Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
hexzhou committed Oct 31, 2020
2 parents e3b95d5 + a9e319f commit e703819
Show file tree
Hide file tree
Showing 28 changed files with 175 additions and 109 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,6 @@ lint/tmp/

# release files
app/release/

#vscode files
.vscode/
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ android {
applicationId "com.github.malitsplus.shizurunotes"
minSdkVersion 26
targetSdkVersion 29
versionCode 20
versionName "1.0.4"
versionCode 23
versionName "1.0.7"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"properties": [],
"versionCode": 20,
"versionName": "1.0.4",
"versionCode": 23,
"versionName": "1.0.7",
"enabled": true,
"outputFile": "app-release.apk"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static String getString(@StringRes int resId){

public static String getStringWithSpace(@StringRes int resId){
if (application != null)
return application.getString(R.string.space_modifier_2, application.getString(resId));
return application.getString(R.string.space_modifier, application.getString(resId));
else
return "";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,33 +83,33 @@ private String getLoopText(int index){
return "";
}

public String getEnemyPatternText(String prefix){
StringBuilder sb = new StringBuilder().append(prefix);

boolean isSinglePattern = true;
for (int it: rawAttackPatterns){
if (it != 1 && it != 0) {
isSinglePattern = false;
break;
}
}
if (isSinglePattern)
return sb.append(I18N.getString(R.string.text_normal_attack_only)).toString();


for (AttackPatternItem it: items){
if (it.loopText.equals("")){
sb.append(it.skillText);
} else if (it.loopText.equals(I18N.getString(R.string.loop_start))){
sb.append(I18N.getString(R.string.text_loop_start)).append(it.skillText);
} else if (it.loopText.equals(I18N.getString(R.string.loop_end))){
sb.append(it.skillText).append(I18N.getString(R.string.text_loop_end)).append("-");
break;
}
sb.append("-");
}
return sb.deleteCharAt(sb.lastIndexOf("-")).toString();
}
// public String getEnemyPatternText(String prefix){
// StringBuilder sb = new StringBuilder().append(prefix);
//
// boolean isSinglePattern = true;
// for (int it: rawAttackPatterns){
// if (it != 1 && it != 0) {
// isSinglePattern = false;
// break;
// }
// }
// if (isSinglePattern)
// return sb.append(I18N.getString(R.string.text_normal_attack_only)).toString();
//
//
// for (AttackPatternItem it: items){
// if (it.loopText.equals("")){
// sb.append(it.skillText);
// } else if (it.loopText.equals(I18N.getString(R.string.loop_start))){
// sb.append(I18N.getString(R.string.text_loop_start)).append(it.skillText);
// } else if (it.loopText.equals(I18N.getString(R.string.loop_end))){
// sb.append(it.skillText).append(I18N.getString(R.string.text_loop_end)).append("-");
// break;
// }
// sb.append("-");
// }
// return sb.deleteCharAt(sb.lastIndexOf("-")).toString();
// }

public class AttackPatternItem{
public String skillText;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ClanBattlePeriod(
val iconBoss2 = phaseList[0].bossList[1].iconUrl
val iconBoss3 = phaseList[0].bossList[2].iconUrl
val iconBoss4 = phaseList[0].bossList[3].iconUrl
val iconBoss5 = phaseList[0].bossList[4].iconUrl
val iconBoss5 = phaseList[phaseList.size - 1].bossList[4].iconUrl

val zodiacImage: Int? = when(startTime.monthValue){
1 -> R.drawable.zodiac_aquarious
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,23 @@ class Equipment(
var craftMap: Map<Item, Int>? = null

fun getCeiledProperty(): Property {
return equipmentProperty.plus(equipmentEnhanceRate.multiply(maxEnhanceLevel.toDouble())).ceiled
return if (equipmentId in uniqueEquipmentIdRange) {
maxEnhanceLevel - 1
} else {
maxEnhanceLevel
}.let {
equipmentProperty.plus(equipmentEnhanceRate.multiply(it.toDouble())).ceiled
}
}

fun getEnhancedProperty(level: Int): Property {
return equipmentProperty.plus(equipmentEnhanceRate.multiply(level.toDouble())).ceiled
return if (equipmentId in uniqueEquipmentIdRange) {
level - 1
} else {
level
}.let {
equipmentProperty.plus(equipmentEnhanceRate.multiply(it.toDouble())).ceiled
}
}

fun getLeafCraftMap(): Map<Item, Int> {
Expand All @@ -56,6 +68,7 @@ class Equipment(
}

companion object {
val uniqueEquipmentIdRange = 130000..139999
val getNull = Equipment(999999,
I18N.getString(R.string.unimplemented),
"",
Expand Down
19 changes: 4 additions & 15 deletions app/src/main/java/com/github/malitsplus/shizurunotes/data/Skill.kt
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,6 @@ class Skill(
val friendlyMinionList = mutableListOf<Minion>()
val enemyMinionList = mutableListOf<Enemy>()

/***
* !!!此类必须在协程中进行实例化!!!
*/
init {
DBHelper.get().getSkillData(this.skillId)?.setSkillData(this)
actions.forEach { action ->
Expand All @@ -182,10 +179,8 @@ class Skill(
}
}
}

actions.forEach { action ->
action.buildParameter()

//如果是召唤技能还需要再读库
if (action.parameter is SummonAction){
//我方召唤物
Expand All @@ -201,9 +196,9 @@ class Skill(
DBHelper.get().getUnitAttackPattern(unitId)?.forEach {
minion?.attackPattern?.add(it.attackPattern)
}
if (minion != null)
if (minion != null) {
friendlyMinionList.add(minion)
unitId
}
}
}
//敌方召唤物
Expand All @@ -217,16 +212,10 @@ class Skill(
}
}
if (!isDuplicate) {
val enemyMinion = DBHelper.get().getEnemyMinion(enemyId)?.enemy?.let { minion ->
DBHelper.get().getUnitAttackPattern(minion.unitId)?.forEach {
minion.attackPatternList.add(it.attackPattern)
}
minion
DBHelper.get().getEnemyMinion(enemyId)?.let {
enemyMinionList.add(it.enemy)
}
if (enemyMinion != null)
enemyMinionList.add(enemyMinion)
}
enemyId
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public enum ActionType {
logBarrier(73),
divide(74),
actionByHitCount(75),
healDown(76),
ex(90),
exPlus(91),
changeEnergyRecoveryRatioByDamage(92),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.github.malitsplus.shizurunotes.common.I18N;
import com.github.malitsplus.shizurunotes.data.Property;
import com.github.malitsplus.shizurunotes.data.PropertyKey;
import com.github.malitsplus.shizurunotes.utils.Utils;

import java.math.RoundingMode;

Expand All @@ -15,7 +16,7 @@ public class AdditiveAction extends ActionParameter {
protected void childInit() {
actionValues.add(new ActionValue(actionValue2, actionValue3, null));

switch ((int) actionValue1){
switch ((int) actionValue1) {
case 7:
keyType = PropertyKey.atk; break;
case 8:
Expand All @@ -31,7 +32,7 @@ protected void childInit() {

@Override
public String localizedDetail(int level, Property property) {
switch ((int) actionValue1){
switch ((int) actionValue1) {
case 0:
return I18N.getString(R.string.Modifier_add_s1_HP_to_value_d2_of_effect_d3,
buildExpression(level, null, RoundingMode.UNNECESSARY, property, false, false, true),
Expand All @@ -41,9 +42,19 @@ public String localizedDetail(int level, Property property) {
buildExpression(level, null, RoundingMode.UNNECESSARY, property, false, false, true),
actionDetail2, actionDetail1 % 10);
case 2:
/*
* TODO: 从表象出发,迎合游戏内数值手动乘个2,欢迎大佬提出有依据的解决方案。有关此bug详情请查看 issue#29
*/
String s1 = buildExpression(level, null, RoundingMode.UNNECESSARY, property, false, false, true);
try {
s1 = Utils.roundIfNeed(2.0 * Double.parseDouble(s1));
} catch (Exception e) {
s1 = "2 * " + s1;
}
return I18N.getString(R.string.Modifier_add_s1_count_of_defeated_enemies_to_value_d2_of_effect_d3,
buildExpression(level, null, RoundingMode.UNNECESSARY, property, false, false, true),
actionDetail2, actionDetail1 % 10);
s1,
actionDetail2,
actionDetail1 % 10);
case 4:
return I18N.getString(R.string.Modifier_add_s1_count_of_targets_to_value_d2_of_effect_d3,
buildExpression(level, null, RoundingMode.UNNECESSARY, property, false, false, true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.github.malitsplus.shizurunotes.common.I18N;
import com.github.malitsplus.shizurunotes.data.Ailment;
import com.github.malitsplus.shizurunotes.data.Property;
import com.github.malitsplus.shizurunotes.utils.Utils;

import java.math.RoundingMode;
import java.util.ArrayList;
Expand All @@ -29,13 +30,21 @@ public String localizedDetail(int level, Property property) {
case action:
String str;
switch ((Ailment.ActionDetail)ailment.ailmentDetail.detail){
// case haste:
// str = I18N.getString(R.string.Raise_s1_d2_attack_speed_for_s3_sec,
// targetParameter.buildTargetClause(), Math.round((actionValue1 - 1) * 100), buildExpression(level, durationValues, RoundingMode.UNNECESSARY, property));
// break;
// case slow:
// str = I18N.getString(R.string.Reduce_s1_d2_attack_speed_for_s3_sec,
// targetParameter.buildTargetClause(), Math.round((1 - actionValue1) * 100), buildExpression(level, durationValues, RoundingMode.UNNECESSARY, property));
// break;
case haste:
str = I18N.getString(R.string.Raise_s1_d2_attack_speed_for_s3_sec,
targetParameter.buildTargetClause(), Math.round((actionValue1 - 1) * 100), buildExpression(level, durationValues, RoundingMode.UNNECESSARY, property));
break;
case slow:
str = I18N.getString(R.string.Reduce_s1_d2_attack_speed_for_s3_sec,
targetParameter.buildTargetClause(), Math.round((1 - actionValue1) * 100), buildExpression(level, durationValues, RoundingMode.UNNECESSARY, property));
str = I18N.getString(R.string.Multiple_attack_speed_of_s1_with_s2_for_s3_sec,
targetParameter.buildTargetClause(),
Utils.roundIfNeed(Double.parseDouble(buildExpression(level, actionValues, RoundingMode.UNNECESSARY, property)) * 100),
buildExpression(level, durationValues, RoundingMode.UNNECESSARY, property)
);
break;
case sleep:
str = I18N.getString(R.string.Make_s1_fall_asleep_for_s2_sec,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
public class AuraAction extends ActionParameter {

enum AuraType{
none(-1),
atk(1),
def(2),
magicStr(3),
Expand All @@ -25,7 +26,7 @@ enum AuraType{
physicalCriticalDamage(11),
magicalCriticalDamage(12),
accuracy(13),
none(14);
maxHP(100);

private int value;
AuraType(int value){
Expand Down Expand Up @@ -58,6 +59,7 @@ public String description(){
case physicalCriticalDamage: return I18N.getString(R.string.Physical_Critical_Damage);
case magicalCriticalDamage: return I18N.getString(R.string.Magical_Critical_Damage);
case accuracy: return PropertyKey.accuracy.description();
case maxHP: return I18N.getString(R.string.max_HP);
default: return "";
}
}
Expand Down Expand Up @@ -117,7 +119,11 @@ protected void childInit() {
actionValues.add(new ActionValue(actionValue2, actionValue3, null));
durationValues.add(new ActionValue(actionValue4, actionValue5, null));
auraActionType = AuraActionType.parse(actionDetail1);
auraType = AuraType.parse(actionDetail1 / 10);
if (actionDetail1 == 1) {
auraType = AuraType.maxHP;
} else {
auraType = AuraType.parse(actionDetail1 / 10);
}
breakType = BreakType.parse(actionDetail2);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,14 @@

public class ChangeParameterFieldAction extends AuraAction {

protected String percentModifier = "";

@Override
protected void childInit() {
super.childInit();
actionValues.clear();
actionValues.add(new ActionValue(actionValue1, actionValue2, null));
durationValues.clear();
durationValues.add(new ActionValue(actionValue3, actionValue4, null));
if (auraType == AuraType.physicalCriticalDamage || auraType == AuraType.magicalCriticalDamage) {
percentModifier = "%";
}
super.percentModifier = PercentModifier.parse(actionDetail2);
}

@Override
Expand All @@ -32,7 +28,7 @@ public String localizedDetail(int level, Property property) {
buildExpression(level, RoundingMode.UP, property),
auraType.description(),
buildExpression(level, durationValues, RoundingMode.UNNECESSARY, property),
percentModifier);
percentModifier.description());
} else {
return I18N.getString(R.string.Summon_a_field_of_radius_d1_at_position_of_s2_to_s3_s4_s5_for_s6_sec,
(int)actionValue5,
Expand All @@ -41,7 +37,7 @@ public String localizedDetail(int level, Property property) {
buildExpression(level, RoundingMode.UP, property),
auraType.description(),
buildExpression(level, durationValues, RoundingMode.UNNECESSARY, property),
percentModifier);
percentModifier.description());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public String localizedDetail(int level, Property property) {
if(actionDetail1 == 100 || actionDetail1 == 200 || actionDetail1 == 300 || actionDetail1 == 500 || actionDetail1 == 501
|| actionDetail1 == 502 || actionDetail1 == 503 || actionDetail1 == 512
|| (actionDetail1 >=600 && actionDetail1 < 900) || (actionDetail1 >= 901 && actionDetail1 < 1000)
|| actionDetail1 == 1300){
|| actionDetail1 == 1300 || actionDetail1 == 1400) {
if(trueClause != null && falseClause != null)
return I18N.getString(R.string.Condition_s, trueClause + falseClause);
else if(trueClause != null)
Expand Down Expand Up @@ -106,7 +106,8 @@ enum IfType{
poison(502),
venom(503),
poisonOrVenom(512),
Break(710);
Break(710),
polymorph(1400);

private int value;
IfType(int value){
Expand Down Expand Up @@ -136,6 +137,7 @@ public String description(){
case venom: return I18N.getString(R.string.venomed);
case poisonOrVenom: return I18N.getString(R.string.poisoned_or_venomed);
case Break: return I18N.getString(R.string.breaking);
case polymorph: return I18N.getString(R.string.polymorphed);
default: return "";
}
}
Expand Down
Loading

0 comments on commit e703819

Please sign in to comment.