Fixed Bug

This commit is contained in:
LingASDJ 2023-07-09 02:34:58 +08:00
parent fcaf22419c
commit 50f825cf51
12 changed files with 143 additions and 17 deletions

5
.gitignore vendored
View File

@ -40,3 +40,8 @@ desktop/replay_pid7460.log
core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass$1.smali
core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/ColdChestBossLevel.smali
gradle.properties
android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/analytics/AnalyticsImpl.java
android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/analytics/AndroidFirebaseService.java
core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/analytics/AnalyticsBelongingsData.java
core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/analytics/AnalyticsGameData.java
core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/analytics/AnalyticsService.java

View File

@ -95,6 +95,7 @@ dependencies {
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
//noinspection GradleDependency
implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
@ -103,7 +104,7 @@ dependencies {
implementation "com.badlogicgames.gdx-controllers:gdx-controllers-android:$gdxControllersVersion"
//WebView冲突兼容问题
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.appcompat:appcompat:1.4.1'
}
// called every time gradle gets executed, takes the native dependencies of

View File

@ -32,6 +32,8 @@ import android.widget.TextView;
import com.badlogic.gdx.graphics.g2d.freetype.FreeType;
import com.badlogic.gdx.utils.GdxNativesLoader;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.shatteredpixel.shatteredpixeldungeon.services.analytics.Analytics;
import com.shatteredpixel.shatteredpixeldungeon.services.analytics.AnalyticsImpl;
public class AndroidLauncher extends Activity {
public FirebaseAnalytics mFirebaseAnalytics;
@ -43,7 +45,7 @@ public class AndroidLauncher extends Activity {
try {
GdxNativesLoader.load();
FreeType.initFreeType();
Analytics.service = AnalyticsImpl.getAnalyticsService();
Intent intent = new Intent(this, AndroidGame.class);
startActivity(intent);
finish();

View File

@ -1,5 +1,6 @@
package com.shatteredpixel.shatteredpixeldungeon.actors;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRetribution;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfPsionicBlast;
@ -21,6 +22,7 @@ public class Boss extends Mob {
immunities.add(Grim.class); //添加Grim类
immunities.add(ScrollOfPsionicBlast.class); //添加ScrollOfPsionicBlast类
immunities.add(ScrollOfRetribution.class); //添加ScrollOfRetribution类
immunities.add(Corruption.class);
}
protected void initBaseStatus(float min, float max, float acc, float eva, float ht, float mid, float mad) {

View File

@ -76,6 +76,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.Swiftthistle;
import com.shatteredpixel.shatteredpixeldungeon.services.analytics.Analytics;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
@ -859,6 +860,10 @@ public abstract class Mob extends Char {
@Override
public void die( Object cause ) {
if (((Char) this).properties.contains(Char.Property.BOSS) && !(this instanceof YogFist)) {
Analytics.trackBossBeaten(this);
}
if (cause == Chasm.class){
//50% chance to round up, 50% to round down
if (EXP % 2 == 1) EXP += Random.Int(2);

View File

@ -65,7 +65,7 @@ public class Sai extends MeleeWeapon {
R = (int) (attacker.HT * 0.1 + (buffedLvl() * 0.5) + 1.5);
attacker.HP +=attacker.HT * 0.1 + (buffedLvl()) + 1.5;
attacker.sprite.showStatus(CharSprite.POSITIVE, ("+" + R + "HP"));
GLog.p("迅猛一击,回血成功!");
GLog.p(attacker.name()+"迅猛一击,回血成功!");
}
return super.proc(attacker, defender, damage);
}

View File

@ -284,7 +284,10 @@ public class CaveTwoBossLevel extends Level {
public void unseal() {
super.unseal();
blobs.get(PylonEnergy.class).fullyClear();
PylonEnergy pylonEnergy = (PylonEnergy) blobs.get(PylonEnergy.class);
if (pylonEnergy != null) {
pylonEnergy.fullyClear();
}
set( entrance, Terrain.ENTRANCE );
int i = 14 + 13*width();

View File

@ -21,9 +21,10 @@
package com.shatteredpixel.shatteredpixeldungeon.levels;
import static com.shatteredpixel.shatteredpixeldungeon.items.Generator.randomArtifact;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.NxhyNpc;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Nyz;
@ -34,6 +35,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.obSir;
import com.shatteredpixel.shatteredpixeldungeon.items.Ankh;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.Stylus;
import com.shatteredpixel.shatteredpixeldungeon.items.food.Pasty;
@ -46,7 +48,6 @@ public class ZeroLevel extends Level {
}
public ZeroLevel() {
Dungeon.isChallenged(32);
this.viewDistance = 15;
}
@ -112,10 +113,8 @@ public class ZeroLevel extends Level {
drop( ( Generator.randomUsingDefaults( Generator.Category.SCROLL ) ), this.width * 20 + 17 );
drop( ( Generator.randomUsingDefaults( Generator.Category.SCROLL ) ), this.width * 19 + 16 );
drop( new Ankh(), this.width * 17 + 20 ).type =
Heap.Type.FOR_SALE;
drop( new Stylus(), this.width * 19 + 20 ).type =
Heap.Type.FOR_SALE;
drop( new Ankh(), this.width * 17 + 20 ).type = Heap.Type.FOR_SALE;
drop( new Stylus(), this.width * 19 + 20 ).type = Heap.Type.FOR_SALE;
drop( ( Generator.randomUsingDefaults( Generator.Category.STONE ) ), this.width * 16 + 19 );
drop( ( Generator.randomUsingDefaults( Generator.Category.FOOD ) ), this.width * 20 + 19 );
@ -132,7 +131,8 @@ public class ZeroLevel extends Level {
drop(( Generator.randomUsingDefaults( Generator.Category.WEP_T2 )), this.width * 18 + 17 );
}
if ( Badges.isUnlocked(Badges.Badge.RLPT)){
drop( ( Generator.randomUsingDefaults( Generator.Category.ARTIFACT ) ), this.width * 18 + 19 );
Item item = randomArtifact();
drop(item, this.width * 18 + 19 );
}
}

View File

@ -0,0 +1,112 @@
package com.shatteredpixel.shatteredpixeldungeon.services.analytics;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.SpiritBow;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.watabou.noosa.Game;
import java.util.LinkedHashMap;
public class Analytics {
public static AnalyticsService service;
public static AnalyticsGameData convertGameToData() {
AnalyticsGameData analyticsGameData = new AnalyticsGameData();
analyticsGameData.gameVersion = Game.version;
analyticsGameData.heroCls = Dungeon.hero.heroClass.name();
analyticsGameData.heroSubCls = Dungeon.hero.subClass.name();
analyticsGameData.heroLvl = Dungeon.hero.lvl;
analyticsGameData.depth = Dungeon.depth;
analyticsGameData.deepest = Statistics.deepestFloor;
analyticsGameData.ascent = Statistics.highestAscent;
analyticsGameData.spawnersAlive = Statistics.spawnersAlive;
analyticsGameData.duration = Statistics.duration;
analyticsGameData.challengeMask = Dungeon.challenges;
analyticsGameData.talents = new LinkedHashMap<>();
if (Badges.isUnlocked(Badges.Badge.CHAMPION_3X)) {
analyticsGameData.bestBossBeaten = "8.6+ Challenges";
} else if (Badges.isUnlocked(Badges.Badge.CHAMPION_2X)) {
analyticsGameData.bestBossBeaten = "7.3+ Challenges";
} else if (Badges.isUnlocked(Badges.Badge.CHAMPION_1X)) {
analyticsGameData.bestBossBeaten = "6.1+ Challenges";
} else if (Badges.isUnlocked(Badges.Badge.VICTORY)) {
analyticsGameData.bestBossBeaten = "5.Yog-Dzewa";
} else if (Badges.isUnlocked(Badges.Badge.BOSS_SLAIN_4)) {
analyticsGameData.bestBossBeaten = "4.King of Dwarves";
} else if (Badges.isUnlocked(Badges.Badge.BOSS_SLAIN_3)) {
analyticsGameData.bestBossBeaten = "3.DM-300";
} else if (Badges.isUnlocked(Badges.Badge.BOSS_SLAIN_2)) {
analyticsGameData.bestBossBeaten = "2.Tengu";
} else if (Badges.isUnlocked(Badges.Badge.BOSS_SLAIN_1)) {
analyticsGameData.bestBossBeaten = "1.Goo";
} else {
analyticsGameData.bestBossBeaten = "0.None";
}
return analyticsGameData;
}
public static void disable() {
if (supportsAnalytics()) {
service.disable();
}
}
public static void enable() {
if (supportsAnalytics()) {
service.enable();
service.trackGameSettings();
}
}
public static void trackBossBeaten(Char ch) {
if (supportsAnalytics()) {
AnalyticsGameData convertGameToData = convertGameToData();
AnalyticsBelongingsData convertBelongingsToData = convertBelongingsToData(Dungeon.hero);
service.trackBossBeaten(convertGameToData, convertBelongingsToData, ch.getClass().getSimpleName());
}
}
public static AnalyticsBelongingsData convertBelongingsToData(Hero hero) {
AnalyticsBelongingsData analyticsBelongingsData = new AnalyticsBelongingsData();
analyticsBelongingsData.items = new LinkedHashMap<>();
for (Item item : hero.belongings) {
Weapon weapon = (Weapon) item;
if (weapon.visiblyUpgraded() > 22 || !Dungeon.customSeedText.isEmpty()) {
analyticsBelongingsData.cheater = true;
}
if (weapon.isEquipped(hero) || Dungeon.quickslot.contains(weapon)) {
boolean z = ((Item) weapon).levelKnown;
((Item) weapon).levelKnown = true;
analyticsBelongingsData.items.put(weapon.name(), weapon.visiblyUpgraded());
Weapon.Enchantment enchantment = weapon.enchantment;
if (enchantment != null) {
analyticsBelongingsData.items.put("Enchant: ".concat(enchantment.getClass().getSimpleName()),
weapon.visiblyUpgraded());
}
if (weapon.augment != null) {
if (weapon instanceof SpiritBow) {
LinkedHashMap<String, Integer> linkedHashMap = analyticsBelongingsData.items;
linkedHashMap.put("BowAug: " + weapon.augment.name(), weapon.visiblyUpgraded());
} else {
LinkedHashMap<String, Integer> linkedHashMap2 = analyticsBelongingsData.items;
linkedHashMap2.put("WepAug: " + weapon.augment.name(), weapon.visiblyUpgraded());
}
}
((Item) weapon).levelKnown = z;
}
}
return analyticsBelongingsData;
}
public static boolean supportsAnalytics() {
return service != null;
}
}

View File

@ -23,7 +23,7 @@ public class GameUpdateNews extends GameUpdateNewsService {
}
Net.HttpRequest httpGet = new Net.HttpRequest(Net.HttpMethods.GET);
httpGet.setUrl("http://www.pd.qinyueqwq.top/ftp/pd/gamenews/gamenews.xml");
httpGet.setUrl("https://www.pd.qinyueqwq.top/ftp/pd/gamenews/gamenews.xml");
Gdx.net.sendHttpRequest(httpGet, new Net.HttpResponseListener() {
@Override

View File

@ -45,7 +45,7 @@ public class ShatteredNews extends NewsService {
}
Net.HttpRequest httpGet = new Net.HttpRequest(Net.HttpMethods.GET);
httpGet.setUrl("http://www.pd.qinyueqwq.top/ftp/pd/news/news.xml");
httpGet.setUrl("https://www.pd.qinyueqwq.top/ftp/pd/news/news.xml");
Gdx.net.sendHttpRequest(httpGet, new Net.HttpResponseListener() {
@Override

View File

@ -1,4 +0,0 @@
package com.shatteredpixel.shatteredpixeldungeon.services.analytics;
public class Analytics {
}