|
7 | 7 | isStatement, |
8 | 8 | loadListedPathById, |
9 | 9 | readEquDocument, |
| 10 | + removeTopLevelSection, |
10 | 11 | replaceTopLevelSection, |
11 | 12 | updateListedPathDocument, |
12 | 13 | } from "@pvf/pvf-mod"; |
@@ -80,13 +81,41 @@ function replaceMinimumInfoName( |
80 | 81 | export function buildSupportSummonDollDocument( |
81 | 82 | sourceDocument: EquDocument, |
82 | 83 | ): EquDocument { |
83 | | - return replaceTopLevelSection( |
84 | | - replaceMinimumInfoName(sourceDocument, SUPPORT_SUMMON_DOLL_NAME), |
| 84 | + const withName = replaceMinimumInfoName(sourceDocument, SUPPORT_SUMMON_DOLL_NAME); |
| 85 | + const withDamageRate = replaceTopLevelSection( |
| 86 | + withName, |
85 | 87 | createSingleFloatLiteralSection( |
86 | 88 | "attack damage rate", |
87 | 89 | SUPPORT_SUMMON_ATTACK_DAMAGE_RATE, |
88 | 90 | ), |
89 | 91 | ); |
| 92 | + const withoutArmorSubtype = removeTopLevelSection(withDamageRate, "armor subtype"); |
| 93 | + return filterEtcAction(withoutArmorSubtype); |
| 94 | +} |
| 95 | + |
| 96 | +function filterEtcAction(document: EquDocument): EquDocument { |
| 97 | + const etcActionSection = getFirstSection(document.children, "etc action"); |
| 98 | + |
| 99 | + if (!etcActionSection) { |
| 100 | + return document; |
| 101 | + } |
| 102 | + |
| 103 | + const filteredSection: EquSectionNode = { |
| 104 | + ...etcActionSection, |
| 105 | + children: etcActionSection.children.filter((child) => { |
| 106 | + if (!isStatement(child)) { |
| 107 | + return true; |
| 108 | + } |
| 109 | + |
| 110 | + return !child.tokens.some( |
| 111 | + (token) => |
| 112 | + (token.kind === "string" || token.kind === "identifier") |
| 113 | + && token.value === "action/ex2.act", |
| 114 | + ); |
| 115 | + }), |
| 116 | + }; |
| 117 | + |
| 118 | + return replaceTopLevelSection(document, filteredSection); |
90 | 119 | } |
91 | 120 |
|
92 | 121 | export async function tryFindAiCharacterByName( |
|
0 commit comments