Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion db/elemental_db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
# AttackDelay Attack speed. (Default: 504)
# AttackMotion Attack animation speed. Base AttackMotion depends on the caster AttackMotion. (Default: 1020)
# DamageMotion Damage animation speed. (Default: 360)
# DamageTaken Rate at which the elemental will receive incoming damage. (Default: 100)
# Mode: List of elemental skills by mode. (Optional)
# <mode>: Mode name to define the skill available. Available modes are Passive, Assist, and Aggressive.
# Skill Skill name.
Expand All @@ -57,7 +58,7 @@

Header:
Type: ELEMENTAL_DB
Version: 1
Version: 2

Footer:
Imports:
Expand Down
3 changes: 2 additions & 1 deletion db/import-tmpl/elemental_db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
# AttackDelay Attack speed. (Default: 504)
# AttackMotion Attack animation speed. Base AttackMotion depends on the caster AttackMotion. (Default: 1020)
# DamageMotion Damage animation speed. (Default: 360)
# DamageTaken Rate at which the elemental will receive incoming damage. (Default: 100)
# Mode: List of elemental skills by mode. (Optional)
# <mode>: Mode name to define the skill available. Available modes are Passive, Assist, and Aggressive.
# Skill Skill name.
Expand All @@ -40,4 +41,4 @@

Header:
Type: ELEMENTAL_DB
Version: 1
Version: 2
8 changes: 7 additions & 1 deletion db/re/elemental_db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
# AttackDelay Attack speed. (Default: 504)
# AttackMotion Attack animation speed. Base AttackMotion depends on the caster AttackMotion. (Default: 1020)
# DamageMotion Damage animation speed. (Default: 360)
# DamageTaken Rate at which the elemental will receive incoming damage. (Default: 100)
# Mode: List of elemental skills by mode. (Optional)
# <mode>: Mode name to define the skill available. Available modes are Passive, Assist, and Aggressive.
# Skill Skill name.
Expand All @@ -57,7 +58,7 @@

Header:
Type: ELEMENTAL_DB
Version: 1
Version: 2

Body:
- Id: 2114
Expand Down Expand Up @@ -241,6 +242,7 @@ Body:
Size: Large
Element: Water
ElementLevel: 4
DamageTaken: 10
Mode:
Passive:
Skill: EM_EL_COLD_FORCE
Expand All @@ -255,6 +257,7 @@ Body:
Size: Large
Element: Fire
ElementLevel: 4
DamageTaken: 10
Mode:
Passive:
Skill: EM_EL_FLAMETECHNIC
Expand All @@ -269,6 +272,7 @@ Body:
Size: Large
Element: Wind
ElementLevel: 4
DamageTaken: 10
Mode:
Passive:
Skill: EM_EL_GRACE_BREEZE
Expand All @@ -283,6 +287,7 @@ Body:
Size: Large
Element: Earth
ElementLevel: 4
DamageTaken: 10
Mode:
Passive:
Skill: EM_EL_EARTH_CARE
Expand All @@ -297,6 +302,7 @@ Body:
Size: Large
Element: Poison
ElementLevel: 4
DamageTaken: 10
Mode:
Passive:
Skill: EM_EL_DEEP_POISONING
Expand Down
22 changes: 11 additions & 11 deletions db/re/skill_db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35672,7 +35672,7 @@ Body:
FixedCastTime: 1500
Requires:
SpCost: 130
ApCost: 25
ApCost: 15
Unit:
Id: Astral_Strike
Range:
Expand Down Expand Up @@ -45745,15 +45745,15 @@ Body:
SpCost: 10
ApCost:
- Level: 1
Amount: 22
Amount: 13
- Level: 2
Amount: 19
Amount: 11
- Level: 3
Amount: 16
Amount: 9
- Level: 4
Amount: 13
Amount: 7
- Level: 5
Amount: 10
Amount: 5
- Id: 6511
Name: SHC_CROSS_SLASH
Description: Cross Slash
Expand Down Expand Up @@ -45874,15 +45874,15 @@ Body:
Time: 500
Cooldown:
- Level: 1
Time: 12500
- Level: 2
Time: 10000
- Level: 2
Time: 8000
- Level: 3
Time: 7500
Time: 6000
- Level: 4
Time: 5000
Time: 4000
- Level: 5
Time: 2500
Time: 2000
FixedCastTime: 1500
Requires:
SpCost:
Expand Down
1 change: 1 addition & 0 deletions doc/yaml/db/elemental_db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
# AttackDelay Attack speed. (Default: 504)
# AttackMotion Attack animation speed. Base AttackMotion depends on the caster AttackMotion. (Default: 1020)
# DamageMotion Damage animation speed. (Default: 360)
# DamageTaken Rate at which the elemental will receive incoming damage. (Default: 100)
# Mode: List of elemental skills by mode. (Optional)
# <mode>: Mode name to define the skill available. Available modes are Passive, Assist, and Aggressive.
# Skill Skill name.
Expand Down
8 changes: 7 additions & 1 deletion src/map/battle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2047,7 +2047,13 @@ int64 battle_calc_damage(block_list *src,block_list *bl,struct Damage *d,int64 d
if (md && md->damagetaken != 100)
damage = i64max(damage * md->damagetaken / 100, 1);
}

else if (bl->type == BL_ELEM) {
s_elemental_data* ed = BL_CAST(BL_ELEM, bl);

if (ed != nullptr && ed->db->damagetaken != 100)
damage = i64max(damage * ed->db->damagetaken / 100, 1);
}

if (tsc != nullptr && !tsc->empty()) {
if (!battle_status_block_damage(src, bl, tsc, d, damage, skill_id, skill_lv)) // Statuses that reduce damage to 0.
return 0;
Expand Down
12 changes: 12 additions & 0 deletions src/map/elemental.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,18 @@ uint64 ElementalDatabase::parseBodyNode(const ryml::NodeRef& node) {
elemental->status.dmotion = 360;
}

if (this->nodeExists(node, "DamageTaken")) {
uint16 damage;

if (!this->asUInt16Rate(node, "DamageTaken", damage, 100))
return 0;

elemental->damagetaken = damage;
} else {
if (!exists)
elemental->damagetaken = 100;
}

elemental->status.aspd_rate = 1000;

if (this->nodeExists(node, "Mode")) {
Expand Down
3 changes: 2 additions & 1 deletion src/map/elemental.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ struct s_elemental_db {
uint16 range2, range3;
status_data status;
view_data vd;
uint16 damagetaken;
std::unordered_map<e_elemental_skillmode, std::shared_ptr<s_elemental_skill>> skill; /// mode, skill
};

Expand All @@ -94,7 +95,7 @@ struct s_elemental_data : public block_list {

class ElementalDatabase : public TypesafeYamlDatabase<int32, s_elemental_db> {
public:
ElementalDatabase() : TypesafeYamlDatabase("ELEMENTAL_DB", 1) {
ElementalDatabase() : TypesafeYamlDatabase("ELEMENTAL_DB", 2, 1) {

}

Expand Down
2 changes: 1 addition & 1 deletion src/map/skills/mage/energyconversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ void SkillEnergyConversion::castendNoDamageId(block_list *src, block_list *targe

// Apply the SP gain to the caster
clif_skill_nodamage(src, *target, getSkillId(), skill_lv);
status_heal(target, 0, (skill_lv * (skill_lv + 1) / 2) * 40, 1);
status_heal(target, 0, (skill_lv * (skill_lv + 1) / 2) * 80, 1);
}
10 changes: 5 additions & 5 deletions src/map/skills/swordman/dragonicbreath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ void SkillDragonicBreath::calculateSkillRatio(const Damage* wd, const block_list
const status_change* sc = status_get_sc(src);
const status_data* sstatus = status_get_status_data(*src);

skillratio += -100 + 50 + 350 * skill_lv;
skillratio += -100 + 250 + 400 * skill_lv;
skillratio += 7 * sstatus->pow;

if (sc && sc->getSCE(SC_DRAGONIC_AURA)) {
skillratio += 3 * sstatus->pow;
skillratio += (skill_lv * (sstatus->max_hp * 25 / 100) * 7) / 100; // Skill level x 0.07 x ((MaxHP / 4) + (MaxSP / 2))
skillratio += (skill_lv * (sstatus->max_sp * 50 / 100) * 7) / 100;
skillratio += (skill_lv * (sstatus->max_hp * 25 / 100) * 7) / 100;
skillratio += (skill_lv * sstatus->max_sp * 7) / 100;
} else {
skillratio += (skill_lv * (sstatus->max_hp * 25 / 100) * 5) / 100; // Skill level x 0.05 x ((MaxHP / 4) + (MaxSP / 2))
skillratio += (skill_lv * (sstatus->max_sp * 50 / 100) * 5) / 100;
skillratio += (skill_lv * (sstatus->max_hp * 25 / 100) * 5) / 100;
skillratio += (skill_lv * sstatus->max_sp * 5) / 100;
}

RE_LVL_DMOD(100);
Expand Down
2 changes: 1 addition & 1 deletion src/tool/csv2yaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ bool Csv2YamlTool::initialize( int32 argc, char* argv[] ){
}

elemental_skill_txt_data(path_db_mode, path_db);
if (!process("ELEMENTAL_DB", 1, root_paths, "elemental_db", [](const std::string &path, const std::string &name_ext) -> bool {
if (!process("ELEMENTAL_DB", 2, root_paths, "elemental_db", [](const std::string &path, const std::string &name_ext) -> bool {
return sv_readdb(path.c_str(), name_ext.c_str(), ',', 26, 26, -1, &read_elementaldb, false);
})) {
return false;
Expand Down
20 changes: 20 additions & 0 deletions src/tool/yamlupgrade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ static bool upgrade_enchantgrade_db( std::string file, const uint32 source_versi
static bool upgrade_item_group_db( std::string file, const uint32 source_version );
static bool upgrade_skill_db( std::string file, const uint32 source_version );
static bool upgrade_item_packages_db( std::string file, const uint32 source_version );
static bool upgrade_elemental_db( std::string file, const uint32 source_version );

template<typename Func>
bool process(const std::string &type, uint32 version, const std::vector<std::string> &paths, const std::string &name, Func lambda) {
Expand Down Expand Up @@ -165,6 +166,12 @@ bool YamlUpgradeTool::initialize( int32 argc, char* argv[] ){
return false;
}

if( !process( "ELEMENTAL_DB", 2, root_paths, "elemental_db", []( const std::string& path, const std::string& name_ext, uint32 source_version ) -> bool {
return upgrade_elemental_db( path + name_ext, source_version );
} ) ){
return false;
}

return true;
}

Expand Down Expand Up @@ -580,6 +587,19 @@ static bool upgrade_item_packages_db( std::string file, const uint32 source_vers
return true;
}

static bool upgrade_elemental_db( std::string file, const uint32 source_version ){
size_t entries = 0;

for( auto input : inNode["Body"] ){
body << input;
entries++;
}

ShowStatus( "Done converting/upgrading '" CL_WHITE "%zu" CL_RESET "' entries in '" CL_WHITE "%s" CL_RESET "'.\n", entries, file.c_str() );

return true;
}

int32 main( int32 argc, char *argv[] ){
return main_core<YamlUpgradeTool>( argc, argv );
}
Loading