Skip to content

Commit

Permalink
2024_10_28_update_all_missing
Browse files Browse the repository at this point in the history
  • Loading branch information
romaniac01 committed Oct 28, 2024
1 parent efae230 commit 81ff6f6
Show file tree
Hide file tree
Showing 12 changed files with 306 additions and 248 deletions.
10 changes: 8 additions & 2 deletions db/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export async function convertEffects(effects, civ, isAdvisor) {
type = "RangedAttack"
break
case "BuildingAttack":
type += "MeleeAttack"
type += "BuildingAttack"
break
case undefined:
case null:
Expand Down Expand Up @@ -633,6 +633,7 @@ const templates = {
BuildLimit: { name: "Build Limit", icon: "BuildLimit", sort: 191 },
Damage: { name: "Damage", icon: "DamageHand", sort: 0 },
DamageMeleeAttack: { name: "Melee Damage", icon: "DamageHand", sort: 0 },
DamageBuildingAttack: { name: "Crush Damage", icon: "DamageHand", sort: 0 },
DamageRangedAttack: { name: "Pierce Damage", icon: "DamageRanged", sort: 0 },
PoisonAttack: { name: "Total Poison Damage Over Time", icon: "DamageOverTime", sort: 92 },
BurningAttack: { name: "Total Burning Damage Over Time", icon: "DamageOverTime", sort: 95 },
Expand Down Expand Up @@ -1134,7 +1135,12 @@ const templates = {
DamageCavalry: { name: "Melee-Cavalry DPS", icon: "DamageCavalry", sort: 25 },
DamageSiege: { name: "Crush DPS", icon: "DamageSiege", sort: 25 },
DamageSiegeMeleeAttack: {
name: "Melee Crush DPS",
name: "Melee Unit DPS",
icon: "DamageSiege",
sort: 25
},
DamageSiegeBuildingAttack: {
name: "Building Crush DPS",
icon: "DamageSiege",
sort: 25
},
Expand Down
3 changes: 3 additions & 0 deletions db/units/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,9 @@ async function convertUnit(unit, tech, equipment) {
if (unit.name === "In_Civ_Villager" || unit.name === "In_Civ_GathererElephant") {
delete stats["GatherHerdable"]
}
if (unit.name ==="Ro_Civ_Engineer") {
stats["DamageSiegeBuildingAttack"] = stats.DamageHand
}

const u = {
id: unit.name,
Expand Down
6 changes: 5 additions & 1 deletion db/units/convert-stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export async function convertUnitStats(unit) {
for (let keyAction in unit.ProtoAction) {
const action = unit.ProtoAction[keyAction]
parseAction(action, stats, inactiveActions)
//console.log(unit)
}
} else if (unit.ProtoAction) {
parseAction(unit.ProtoAction, stats, inactiveActions)
Expand Down Expand Up @@ -257,7 +258,10 @@ export function parseAction(action, stats, inactiveActions) {
if (action.DamageType) {
if (action.DamageType === "Siege") {
let actionName = name
if (actionName === "ChopAttack" || actionName === "BuildingAttack") {
if (actionName === "BuildingAttack") {
actionName = "BuildingAttack"
}
if (actionName === "ChopAttack") {
actionName = "MeleeAttack"
}
stats["Damage" + action.DamageType + actionName] = action.Damage
Expand Down
11 changes: 9 additions & 2 deletions db/upgrades/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,24 @@ async function convertEquipmentToUpgrades(equipment) {
const civ = equipment.civ.toLowerCase()
for (let i = 0; i < equipment.reward.rank.length; i++) {
const reward = equipment.reward.rank[i]
//console.log(reward.tech)
const tech = findByAttribute(techtree, "name", reward.tech)
if (tech && !techIgnored(tech)) {
if(tech.name.startsWith("IndiaTechRMMonastery")) {
for (let i = 0; i < tech.Effects.effect.length; i++) {
//console.log(tech.Effects.effect[i].text)
const toggleTech = findByAttribute(techtree, "name", tech.Effects.effect[i].text)
const toggleUpgrade = await convertUpgrade(toggleTech, civ)
results.push(toggleUpgrade)
}
}
const upgrade = await convertUpgrade(tech, civ)
if (equipment.unlocked !== undefined) {
upgrade.unlocked = equipment.unlocked
}
if (includeUpgrade(upgrade)) {
if (tech.name === "PersiaTechVillagerUnlock1") {
results.push(upgrade)
}
}
else if (
tech.Prereqs &&
tech.Prereqs.techStatus &&
Expand Down
Binary file modified public/assets/sprites/upgrades.webp
Binary file not shown.
2 changes: 1 addition & 1 deletion public/sitemap.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://unitstats.projectceleste.com</loc><lastmod>2024-10-27T15:19:35.302Z</lastmod><changefreq>weekly</changefreq><priority>1.0</priority></url></urlset>
<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://unitstats.projectceleste.com</loc><lastmod>2024-10-27T23:31:24.089Z</lastmod><changefreq>weekly</changefreq><priority>1.0</priority></url></urlset>
42 changes: 32 additions & 10 deletions src/components/Stats.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ export default {
})
}
for (let i = 0; i < this.advisors.length; i++) {
const advisorEffects = this.advisors[i].effects.filter(e =>
effectAppliesToUnit(e, this.unit)
)
for (let j = 0; j < advisorEffects.length; j++) {
this.applyEffect(advisorEffects[j], stats, this.unit)
}
}
for (let key in this.gear) {
const gear = this.gear[key]
for (let i = 0; i < gear.stats.effects.length; i++) {
Expand All @@ -127,20 +136,25 @@ export default {
effectAppliesToUnit(e, this.unit)
)
for (let j = 0; j < milestoneEffects.length; j++) {
this.applyEffect(milestoneEffects[j], stats, this.unit)
let activeType = 0
for (let k = 0; k < this.unit.types.length; k++) {
if (this.unit.types[k] === milestoneEffects[j].target) {
activeType = 1
if (
this.unit.id === "In_Civ_GathererElephant" &&
this.unit.types[k] === "AbstractVillager"
) {
activeType = 0
}
}
}
if (activeType === 1) {
this.applyEffect(milestoneEffects[j], stats, this.unit)
}
}
}
}
for (let i = 0; i < this.advisors.length; i++) {
const advisorEffects = this.advisors[i].effects.filter(e =>
effectAppliesToUnit(e, this.unit)
)
for (let j = 0; j < advisorEffects.length; j++) {
this.applyEffect(advisorEffects[j], stats, this.unit)
}
}
const upgradeEffects = []
for (let upgradeID in this.upgrades) {
this.filterUpgradeEffects(this.upgrades[upgradeID], upgradeEffects)
Expand Down Expand Up @@ -494,6 +508,14 @@ export default {
}
})
break
case "DamageBuildingAttack":
for (let keyDmg in stats) {
if (keyDmg === "DamageSiegeBuildingAttack") {
this.setBaseStat(stats, keyDmg)
stats[keyDmg] *= mod
}
}
break
case "DamageMeleeAttack":
for (let keyDmg in stats) {
if (
Expand Down
2 changes: 1 addition & 1 deletion src/data/effects.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/units.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/upgrades.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions src/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ export function upgradeAppliesToUnit(u, unit) {
let compensatedCount = 0
for (let i = 0; i < u.effects.length; i++) {
//for some reason engineer shows as having dmg, but it doesnt really
if (u.id === "TechMeleeAttack1" && unit.id === "Ro_Civ_Engineer") {
/*if (u.id === "TechMeleeAttack1" && unit.id === "Ro_Civ_Engineer") {
continue
} else {
const e = u.effects[i]
if (effectAppliesToUnit(e, unit)) {
appliedCount++
if (checkCompensation(u.effects, e.type, unit)) {
compensatedCount++
}
} else {*/
const e = u.effects[i]
if (effectAppliesToUnit(e, unit)) {
appliedCount++
if (checkCompensation(u.effects, e.type, unit)) {
compensatedCount++
}
}
//}
}
return appliedCount > compensatedCount
}
Expand Down
Loading

0 comments on commit 81ff6f6

Please sign in to comment.