Skip to content

Commit

Permalink
Arlecchino (#2168)
Browse files Browse the repository at this point in the history
* initial arlecchino commit

* Updated NA frames

* Updated CA frames

* Updated Skill frames

* Updated Burst frames

* Updated Plunge frames

* Updated N0 frames

* Added Arlecchino shortcut

* Update mode-gcsim.js for new char shortcut

* Adjust burst and c2 AoE

* Adjust skill aoe

* Adjusted Hitboxes for offsets for NA/CA/Q/E/C2

* Removed incorrect comment

* Adjusted Burst heal comment

* Added C2 Damage delay frames

* Added AoE data

* Added frames documentation

* Added hitlag documentation

* Added nickname documentation

* Added param documentation

* Adjusted directive absorb AoE

* Moved location of absorbDirective func

* Added early cancel for CA

* Moved absorbDirectives func to skill.go

* Changed early_cancel to only work if the following action is Dash or Jump

* Fixed charge early cancel with swap not giving correct error

* reupload freminet and lynette frames (#2167)

* fix haran (#2162)

* Fixed overheal to be float64

* Removed swap CD change

* Fixed onSwap name

* Changed early cancel checks to happen in NextQueueItemIsValid

* exposes the current BoL and BoLratio of a character (#2169)

* apply beidou shield on skill tap (#2170)

* Clam and SoDP use total healing before BoL reduction. (#2161)

* fix echoes icd bug (#2166)

* fix echoes icd bug

* fix typo in echoes.go

* Added Missing BoL Documentation (#2172)

* exposes the current BoL and BoLratio of a character

* Updated documentation for BoL and BoL Ratio

* add Crimson Moon's Semblance (#2164)

* add Crimson Moon's Semblance

* refactor crimsonmoonssemblance

* add Fragment of Harmonic Whimsy (#2163)

* add Fragment of Harmonic Whimsy

* update fohw condition

* update shortcut

* use StatModIsActive

* add passive scaling to pipeline (#2173)

* add passive scaling to pipeline

* fix lint error

* fix linter issues from new linter version (#2175)

* nahida xq/yl n0 (#2171)

* NextQueueItemIsValid to use active char instead of next char (#2174)

* NextQueueItemIsValid to use active char instead of next char

* should pass in next char in NextQuestItemIsValid

* move implicit swap to evaluator to avoid skipping CanQueueAfter

* clean up comment

* Fixed NextQueueItemIsValid signature for Arlechinno

* Fix linting

* Renamed a1Directive to directiveScaling

* Removed getTotalAtk()

* Changed c6 buff to be hitlag extended

* Changed c6 to use a callback instead of a subscription

* Fixed redundant func

* Fixed long line of code

* Removed early cancelled flag in favour of checking the previous action and params

* Removed uneeded today

* Changed masque status duration to -1

* Added clarifying comment to switch behaviour

* fix c6

---------

Co-authored-by: soloxcx <58927267+soloxcx@users.noreply.github.com>
Co-authored-by: Keng <39216134+Siwat-Keng@users.noreply.github.com>
Co-authored-by: clevernt <Azozy2011.hd@gmail.com>
Co-authored-by: Liu Yihua <yihuajack@live.cn>
Co-authored-by: srl <906239+srliao@users.noreply.github.com>
Co-authored-by: imring <vitaliyvorobets25@gmail.com>
  • Loading branch information
7 people committed Jun 20, 2024
1 parent 6bd1616 commit 05c4c6f
Show file tree
Hide file tree
Showing 24 changed files with 1,980 additions and 4 deletions.
124 changes: 124 additions & 0 deletions internal/characters/arlecchino/arlecchino.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
package arlecchino

import (
"fmt"

tmpl "github.com/genshinsim/gcsim/internal/template/character"
"github.com/genshinsim/gcsim/pkg/core"
"github.com/genshinsim/gcsim/pkg/core/action"
"github.com/genshinsim/gcsim/pkg/core/event"
"github.com/genshinsim/gcsim/pkg/core/glog"
"github.com/genshinsim/gcsim/pkg/core/info"
"github.com/genshinsim/gcsim/pkg/core/keys"
"github.com/genshinsim/gcsim/pkg/core/player/character"
"github.com/genshinsim/gcsim/pkg/model"
)

func init() {
core.RegisterCharFunc(keys.Arlecchino, NewChar)
}

type char struct {
*tmpl.Character
skillDebt float64
skillDebtMax float64
initialDirectiveLevel int
}

func NewChar(s *core.Core, w *character.CharWrapper, _ info.CharacterProfile) error {
c := char{}
c.Character = tmpl.NewWithWrapper(s, w)

c.EnergyMax = base.SkillDetails.BurstEnergyCost
c.NormalHitNum = normalHitNum
c.NormalCon = 3
c.BurstCon = 5

w.Character = &c

return nil
}

func (c *char) Init() error {
c.naBuff()
c.passive()

c.a1OnKill()
c.a4()

c.c2()
return nil
}

func (c *char) NextQueueItemIsValid(k keys.Char, a action.Action, p map[string]int) error {
lastAction := c.Character.Core.Player.LastAction
if k != c.Base.Key && a != action.ActionSwap {
return fmt.Errorf("%v: Tried to execute %v when not on field", c.Base.Key, a)
}

if lastAction.Type == action.ActionCharge && lastAction.Param["early_cancel"] > 0 {
// can only early cancel charged attack with Dash or Jump
switch a {
case action.ActionDash, action.ActionJump: // skips the error in default block
default:
return fmt.Errorf("%v: Cannot early cancel Charged Attack with %v", c.Base.Key, a)
}
}

// can use charge without attack beforehand unlike most of the other polearm users
if a == action.ActionCharge {
return nil
}
return c.Character.NextQueueItemIsValid(k, a, p)
}

func (c *char) AnimationStartDelay(k model.AnimationDelayKey) int {
switch k {
case model.AnimationXingqiuN0StartDelay:
return 15
case model.AnimationYelanN0StartDelay:
return 7
default:
return c.Character.AnimationStartDelay(k)
}
}

func (c *char) Heal(hi *info.HealInfo) (float64, float64) {
hp, bonus := c.CalcHealAmount(hi)

// save previous hp related values for logging
prevHPRatio := c.CurrentHPRatio()
prevHP := c.CurrentHP()
prevHPDebt := c.CurrentHPDebt()

// calc original heal amount
healAmt := hp * bonus

// calc actual heal amount considering hp debt
heal := healAmt - c.CurrentHPDebt()
if heal < 0 {
heal = 0
}

// overheal is always 0 when the healing is blocked
overheal := 0.0

// still emit event for clam, sodp, rightful reward, etc
c.Core.Log.NewEvent(hi.Message, glog.LogHealEvent, c.Index).
Write("previous_hp_ratio", prevHPRatio).
Write("previous_hp", prevHP).
Write("previous_hp_debt", prevHPDebt).
Write("base amount", hp).
Write("bonus", bonus).
Write("final amount before hp debt", healAmt).
Write("final amount after hp debt", heal).
Write("overheal", overheal).
Write("current_hp_ratio", c.CurrentHPRatio()).
Write("current_hp", c.CurrentHP()).
Write("current_hp_debt", c.CurrentHPDebt()).
Write("max_hp", c.MaxHP())

c.Core.Events.Emit(event.OnHeal, hi, c.Index, heal, overheal, healAmt)

return heal, healAmt
}
Loading

0 comments on commit 05c4c6f

Please sign in to comment.