your current location:首页 > news>[1.16.x] Principle direction: Star Magic の Experience Guide [AS] Astral Sorcery (ASTRAL Sorcery) Minecraft Game

[1.16.x] Principle direction: Star Magic の Experience Guide [AS] Astral Sorcery (ASTRAL Sorcery) Minecraft Game

2024-12-10 17:51:05|Myriagame |source:minecraft skins

This tutorial is set by the author to use the CC by-NC protocol.

——NTRO introduction -------

The writing of this tutorial is based on the 1.16-indev version source code released by 2022 JUN 1!The text used is 1.16 translation text.

In the process of star magic (hereinafter referred to as AS), the upgrade of star ability is a very important thing, and it is also one of the key gameplay.This tutorial will analyze AS's star ability experience at the source code level, and give some personal suggestions.

Because the source code will be involved, this tutorial is more suitable for people who have a little better understanding of some programming knowledge.

In addition, the game's random engraving (Tick) will also be used in this tutorial, so please first understand the random carving before reading it.

Some mathematical knowledge used in this article:

Floor (x) ->

CLAMP (x, min, max) -> Take the value on X, but when x is lower than min, you take min, and take MAX when it is greater than MAX

I will put the prompts ahead of the more hard core part. If you want to understand, you don't need to read this tutorial completely. You can read it on demand.

——Astral sorcery level star capability level —————————

The star capability level is up to 40 under the default situation. Of course, it can also be changed by modifying the configuration file, and the range of changes is 10 ~ 100.The experience value of each level of demand is 150 + 100 * Floor (1.2 L Evel ).This also means that experience requirements have a growth rate of 1.2 times. Under the conditions of the final 100 level, the demand will become very scary.

Here are some levels of experience and total experience requirements.(Based on the results of Python calculation, the result may be errors with the data after Java running, and the use of formats is more suitable for Chinese reading)

Level experience demand for this level reaches the total experience of this level (-1) 1250250535013502032502,07004012,255073,8 40060469,57502817,9100801,915010,160010069,7950414 0899,6500

Source code about level experience:

 Private void buildlevelrequirements () {) {

If (This.totalexpleVELREQUIRED.ISEMPTY ()) {{) {) {

For (int i = 1; i <= this.Levelcap; i ++) {

Long prev = this.totalexpleVELREQUIREQUIREDORDERDEFAULT (i-1, 0L); this.totalexpleVELREQUIRED.PUT (i, Prev+150L+100L*mathhelper.floor (MAT h.pow (1.2F, i));

}

}

}

(All the source code here-> hellfirepvp.astralsorcery.common.perk.perklevelManager.java)

It should be noted that the author has setting restrictions on the size of a single acquisition experience. Regardless of the experience of a single acquisition, the final experience will not exceed 8%of the current level of experience.

About the source code for experience:

 Protected Void ModifyExp (Double Exp, PlayEncentity Player) {

Int Currlevel = PerklevelManager.GetLevel (getperKexp (), Player, LogicalSide.server);

If (exp> = 0 && carrlevel> = PerklevelManager.GetLevelCap (logicalSide.server, player) {

Return;

}

Long ExpthisLevel = PerklevelManager.GetexPFORLEVEL (Currlevel, Player, LogicalSide.server);

Long expnextLevel = PerklevelManager.Getexpformlevel (CurrLlevel+1, Player, LogicalSide.Server); Long Cap = Mathhelper.lfloor ((Float) (ExpinextLev) El-ExpthisLevel))*0.08F);

If (exp> cap) {

Exp = cap;

}

This.perkexp = math.max (this.perkexp+exp, 0);

}

(All source code here-> hellfirepvp.astralsorcery.common.data.research.playerkdata.java)

—— Vicio experience acquisition: Yuxuza —————————

First of all, explain a constellation with a relatively simple experience acquisition mechanism: Yu Xu seat.

In the book, the author introduces to us that Yuxuza obtain experience through traveling around the world.What is actually?

In fact, the real needs of Yuxuza are moving, as long as you move, running, running, flying, spleen, and swimming:

Each tick, the system calculates the straight line distance (unit: block) of the player in the tick through the above method.

After that, take the distance between each item to each coefficient, and then add the five items to the 0.02 and star capability to obtain the recovery.

Movement method Walking, running and flying spleen swimming experience acquisition coefficient 0.90.80.30.551.2

It should be noted that the single calculation limit of each item is 500 square meters, and the more than 500 -frames are calculated based on 500 square meters.

About the source code obtained by the experience of imperial seat:

@outerride

Public void OnPlayertick (Playrence Player, LogicalSide Side) {{

If (! Side.isserver () ||!

Return;

}

Uuid uuid = player.getuniqueid (); ServerplayErentity splayer = (serverPlayEncentity) player;

Playerprogress prog = Researchhelper.getprogress (Player, SIDE);

StatisticSManager mgr = splayer.getStats ();

Int Walked = MGR.GetValue (stats.custom.get (stats.Walk_one_CM));

Int Sprint = mgr.getvalue (stats.custom.get (stats.sprint_one_cm));

Int Flown = MGR.GetValue (stats.custom.get (stats.fly_one_cm));

Int Elytra = mgr.getValue (stats.custom.get (stats.aviate_one_cm));

Int Swam = mgr.getValue (stats.custom.get (stats.swim_one_cm));

Int Lastwalked = this.movetrackMap.ComputeiFabSENT (stats.walk_one_cm, s-> new hashmap <> ()).

Int LastSprint = this.movetrackMap.comPuteifabSEnt (stats.sprint_one_cm, s-> new hashmap <> ()).

int lastfly = this.movetrackMap.comPuteifabSEnt (stats.fly_one_cm, s-> new hashmap <()). ComputeifabSEnt (uuid, u-> flown); int L Astelytra = this.movetrackMap.comPuteifabSEnt (stats.aviaviate_one_cm, s-> s->new hashmap <> ()). ComputeifabSEnt (uuid, u-> elytra);

Int Lastswam = this.movetrackMap.comPuteifabSEnt (stats.swim_one_cm, s-> new hashmap <> ()).

Float added = 0;

If (WALKED> Lastwalked) {

Added+= math.min (Walked-LastWalked, 500F);

If (added> = 500F) {

Added = 500F;

}

Added*= 0.9F;

This.movetrackMap.get (stats.Walk_one_CM) .put (uuid, walked);

}

If (Sprint> LastSprint) {

Added+= math.min (sprint-LastSprint, 500F); if (add> = 500F) {

Added = 500F;

}

Added*= 0.8F;

This.movetrackMap.get (stats.sprint_one_cm) .put (uuid, sprint);

}

If (Flown> Lastfly) {

Added+= math.min (Flown-Lastfly, 500F);

Added*= 0.3F;

This.movetrackMap.get (stats.fly_one_cm) .put (uuid, flown);

}

Iftra> Lastelytra) {

Added+= math.min (Elytra-Lastelytra, 500F);

Added*= 0.55F;

This.movetrackMap.get (stats.aviaviate_one_cm). Put (uuid, ELYTRA);

} If (SWAM> Lastswam) {

Added+= math.min (SWAM-LASTSWAM, 500F);

Added*= 1.2F;

This.movetrackMap.get (stats.swim_one_cm) .put (uuid, swam);

}

If (added> 0) {

Added*= 0.02F;

Added*= this.Getexpmultiplier ();

Added*= this.getdiminishINGRETURNS (player);

Added*= Perkattributehelper.getorCreateMap (Player, SIDE) .getmodifier (Player, Prog, PerkattributeTypesa_Type_Inc_Perk_Effect)

Added*= Perkattributehelper.getorCreateMap (Player, SIDE) .Getmodifier (Player, Prog, PerkattributeTypes.attr_INC_PERK_EXP);

Added = Attributeevent.postProcessModed (Player, Perkattributetypesas.attr_INC_PERK_EXP, Added);

ResearchManager.modifyExp (player, added);}

}

(All source code here-> hellfirepvp.astralsorcery.common.perk.node.rootvicio.java)

——Diminishing multiplier Source: Subtiliated Double Ringer ———————

Before we continue to introduce the other four constellations, I need to introduce a heavyweight role first, so that we can get the ruthless person who has become extremely uncomfortable: decreased the multiplier.

In the process of playing, everyone may have encountered such problems: I have dug a few blocks, how can I get one level/why I feel that the efficiency of brushing is getting lower and lower ...Decreasing multiplier device is absolutely indispensable.(Bushi

In AS, each player has one or more. Someone really finds that the five roots can be clicked at the same time?For calculating experience to obtain a multiplier, a decreasing multiplier (when multiple constellations are calculated at the same time, each constellation has its own independent decreasing multiplier), which willIn a large number of blocks, one -time damage is caused by you are looking for: plant magic) greatly reduces the experience we can get.

Attentive readers may have discovered that in the source code of a constellation above, there is such a sentence:

 added*= this.getdiminishINGRETURNS (player); 

In other words, the final calculated experience will be taken by this decreasing multiplier, and this code exists in the source code of the five constellations!

So in order to understand the four constellations, we need to understand this multiplier decrease.

First of all, what is its trigger mechanism?This is relatively simple. When the player has made multiple experiences in a single tick, the decreaser will be activated.

For example, when a manuscript with an increase in the excavation range comes with AS is used for excavation, except for the first calculated block, each other block will trigger a decreaser once.

After each trigger a decreaser, AS will minus the experience obtaining a fixed number: the decrease rate driprate and set the minimum value min.In this way, as the blocks excavated in a single Tick are constantly being calculated, the lower the experience obtained by the calculated blocks.

So the question comes, how can I improve the multiplier of experience I have fallen?It is very simple, as long as you do not trigger multiple acquisition experience in a single tick.

When the player does not trigger a single Tick to obtain experience multiple times, but if the single Tick obtains a single experience, the experience acquisition rate will increase according to the following formula, the maximum does not exceed 1:

Among them, the recovery multiplier and recovery time are preset, and the additional recovery magnification will gradually increase with the maximum value of 4 with each single Tick obtaining a single experience.Back.

After understanding its operating mechanism, we can take the right medicine and make our experience more scientific!

Below is the preset value of the decreasing multiplier of the five constellations:

Constellation decreased rate Dropterate recovery time Gainmstime recovery multiplier Gainerate minimum value mining 0.0051000MS0.10.15 Jia Royal seat 0.222000MS0.30.01 Attack fierce seat 0.0256000MS0.0750.15 Live seats 1600.01 Royal Wald Seat 0.0 0.0 0310000MS0.0650.2

So the question is?Obviously there is a mechanism for the imperial virtual seat. Why do I first talk about the imperial seat instead of introducing the decreasing multiplier?

In fact, it is very simple. The triggering condition of the decreasing multiplier is to obtain experience in a single Tick, and the experience acquisition of Yuxuza is a constant Tick update once. Under normal circumstancesNo need to understand the multiplier decreaser.Source codes for decreasing multiples:

(From here, it can be seen that in fact, the real judgment is actually within one milliseconds, but because the author does not know whether the trigger in the MC is unconditionally aroused, the default is single tick cycle processingSpeed ​​up, so that the events triggered in such a single tick will almost be considered as triggered in a single minute. Even if there is an error, the impact is very small. For example, when the experience interval is 1ms, although the multiplier rate will not be deducted, the rate of recovery can actually be in fact.Few, almost 0)

 Private void recalcmultiplier () {

Long now = System.currenttiMillis ();

Long do = now-this.lastgain;

Long times = (Diff*(this.recoverystack+1))/this.gainmstime;

If (times> 0) {

This.lastgain = now;

This.Recoverystack = math.min (this.Recoverystack+1, 3);

This.multiplier = mathhelper.clamp (this.multiplier+times*gainrate, this.min, 1F);

} Else {

This.multiplier = math.max (this.multiplier-this.droprate, this.min);

This.Recoverystack = 0;

}

}

(All source code here: hellfirepvp.astralsorcery.common.util.diminishingmultiplier.java) —— Armara Experience Garment: Jia Yuza ————————————————————————————————

Let's introduce the experience of Jiayuzo.

In the Xinghui dictionary, it describes its experience to obtain it: to obtain experience by undergoing damage.

This statement is not false, but its internal mechanism is slightly more complicated than what it introduces:

When it is injured, it will calculate the final experience obtained in the form of judgment:

The final experience value = the total amount of damage (getamount)*experience obtaining multiple (MUL)*star ability experience acquisition rate.

At this time, someone may ask, why did you bring a cute decreasing multiplier in the end?

This is because there is an invincible frame mechanism in the original MC, that is, the player will not be harmed again within a certain period of time after being hit, and the trigger conditions of the reduced multiplier device are single TICK multiple acquisition experience.It is not difficult to know. Under normal circumstances, players cannot trigger a single Tick many times, and they will not be reduced by diminishing multiples.Gaiasan: Want to think about me?

About the source code obtained by the experience of Jiayu seat:

 Private void onhurt (livingHurtevent Event) {

If (! (Event.Getentityliving () Instanceof PlayErentity)) {{

Return;

}

Playrence Player = (Playerntity) Event.GetentityLiving ();

LogicalSide size = this.getside (player);

If (! Side.isserver ()) {{

Return;

}

Playerprogress prog = Researchhelper.getprogress (Player, SIDE);

If (! Prog.getperkData (). HasperKeffect (this) {{

Return;

}

Float mul = 0.5F; Combattracker Combat = Player.getCombattracker ();

If (COMBAT.COMBAT) {

// none is this long in combat ...

If (Combat.getCombatduration () <= (4*60*20)) {{

Mul = 10.0F;

} Else {

Mul = 0.05F;

}

} Else if (event.getsource (). GettrueSource () Instanceofl Livingntity) {

Mul = 3.0F;

}

Float expgain = math.min (event.getamount ()*mul, 70F);

Expgain*= this.Getexpmultiplier ();

Expgain*= this.getdiminishINGRETURNS (player);

Expgain*= Perkattributehelper.getorCreateMap (Player, SIDE) .Getmodifier (Player, Prog, PerkattributeTypes.attr_INC_PERK_EFFECT); Expgain*= Perkattributehelper.getorCreateMap (Player, SIDE) .Getmodifier (Player, Prog, Perkattributeypes.attr_INC_PERK_EXP)

Expgain = Attributeevent.postProcessModed (Player, Perkattributetypesas.attr_INC_PERK_EXP, Expgain);

ResearchManager.modifyExp (player, expgain);

}

(All source code here-> hellfirepvp.astralsorcery.Common.perk.node.root.rootarmara.java)

——Discidia Experience Get: Steading Bart-

Next is the opposite of Jiayu seat: attacking the martyrs!

The experience acquisition mechanism of attacking martial arts is actually relatively simple, that is, as long as the player is in the combat state less than 2 minutes (2400 engraved), the basal multiplier is 4, and once it is greater than 2 minutes, the basis rate becomes 0.01.

The final experience is: a single damage*basic multiplier*Star ability experience acquisition multiplier*reduction multiplier

This also explains why it has been hanging on the monster tower, and the follow -up experience will become very little: after two minutes of hanging up, under the dual sanctions of the mechanism and decreasing multiplier, their experience acquisition will be pressed to the original ones.One in ten thousand, naturally there will be no higher efficiency.

Source code for the experience of attacking martyrs:

 Private Void ODAMAGE (LivingDamageEvent Event) {

Damagesource ds = event.getsource ();

Playrence Player = null;

If (DS.GetimdiaTesource ()! = NULL &&

DS.GetimdiaTesource () InstanceOf Playrence) {{

Player = (PlayEncentity) ds.getImmediateSource ();}

If (Player == NULL && DS.GettrueSource ()! = Null &&

Ds.gettrueSource () Instanceof Playrence) {{

Player = (Playrence) ds.gettrueSource ();

}

If (player == null) {

Return;

}

LogicalSide size = this.getside (player);

If (! Side.isserver ()) {{

Return;

}

Playerprogress prog = Researchhelper.getprogress (Player, SIDE);

If (! Prog.getperkData (). HasperKeffect (this) {{

Return;

}

Float mul = 4.0F;

Combattracker Combat = Event.Getentityliving (). Getcombattracker (); if (commbat.incombat) {

If (Combat.getCombatduration ()> (2*60*20)) {{

Mul = 0.01F;

}

}

Float expgain = math.min (event.getamount ()*mul, 100F);

Expgain*= this.Getexpmultiplier ();

Expgain*= this.getdiminishINGRETURNS (player);

Expgain*= Perkattributehelper.getorCreateMap (Player, SIDE) .Getmodifier (Player, Prog, PerkattributeTypes.attr_INC_PERK_EFFECT);

Expgain*= Perkattributehelper.getorCreateMap (Player, SIDE) .Getmodifier (Player, Prog, Perkattributeypes.attr_INC_PERK_EXP)

Expgain = Attributeevent.postProcessModed (Player, Perkattributetypesas.attr_INC_PERK_EXP, Expgain);

ResearchManager.modifyExp (player, expgain);

}

(All the source code here-> HelloPirepvp.astralsorcery.Common.Perk.Node.root.rootdiscidia.java) — AEVITAS/EVORSIO Experience: Best Block/Removal Block ——

Next is two constellations that are dominated by square blocks. At the same time, their experience acquisition is also closely related to the hardness of the block.

For the raising seat, it calculates it when the player placed the block:

Get experience of this time = Clamp (placed block hardness, min: 1, max: 25) *4 *Star ability experience acquisition multiplier

And the unclea seat is calculated like this:

This destruction obtaining experience = Destroyed block hardness (default 0.5 when obtaining it) *Star ability experience acquisition rate *decreasing multiplier

In particular, when the block that the player is destroyed is an unable to destroy the block (such as the base rock, etc.), the hardness is 0.

It should be noted that because the decreased rate of the decreasing percentage of the birthplace is 1, that is, once the single Tick is placed multiple times, it will cause a decreasing multiplier to directly punish to the minimum value of 0.01.Whether to use some very means to place a large block.

The following is the hardness table of some common blocks:

Below Ice Ice/Floating/Frost Ice/Sand/Red Sand/Soul Sand/Earth/Soul Earth/Concrete Powder Gravel Stone/Stealing Box Last Stone/Deep Rock Deep Balnite Wasting Obsidian 0.40.50.61.5233.550

Source code for the experience of life -reinforcement seats:

 Private void onPlace (blockvent.entityplaceevent event) {

If (! (Event.Getentity ()) Instanceof Playrence) {{

Return;

}

Playrence Player = (Playrence) event.getitity ();

LogicalSide size = this.getside (player);

If (! Side.isserver ()) {{

Return;

}

Playerprogress prog = Researchhelper.getprogress (Player, SIDE);

If (! Prog.getperkData (). HasperKeffect (this) {{

Return;}

Float Hardness;

Try {

Hardness = math.max (event.getplacedBlock (). GetBlockhardness (event.getwork (), event.getpos ()), 1F); 1F); 1F)

} Catch (Exception Exc) {

Hardness = 1F;

}

Float XP = Math.min (Hardness*4F, 100F);

Xp*= this.Getexpmultiplier ();

Xp*= this.getdiminishINGRETURNS (player);

XP*= Perkattributehelper.getorCreateMap (Player, SIDE) .Getmodifier (Player, Prog, Perkattributeypes.attr_INC_PERK_EFFECT);

XP*= Perkattributehelper.getorCreateMap (Player, SIDE) .Getmodifier (Player, Prog, Perkattributeypes.attr_INC_PERK_EXP);

XP = Attributeevent.postProcessModed (Player, Perkattributetypesas.attr_INC_PERK_EXP, XP);

ResearchManager.modifyExp (player, XP);

}

(All the source code is here-> HelloPirepvp.astralsorcery.Common.Perk.Node.root.rootaevitas.java) Source code for the experience of dissipating seats:

 Private void onBreak (blockevent.breakevent event) {

Playrence Player = Event.getplayer ();

LogicalSide size = this.getside (player);

If (! Side.isserver ()) {{

Return;

}

Playerprogress prog = Researchhelper.getprogress (Player, SIDE);

If (! Prog.getperkData (). HasperKeffect (this) {{

Return;

}

Blockstate broken = event.getState ();

Iworld world = event.getwork ();

Float gaineDexp;

Try {

GaineDexp = Broken.getBlockhardness (world, event.getpos ());

} Catch (Exception Exc) {

GaineDexp = 0.5F;

}

If (GAINEDEXP <0) {Return; // Unbreakable

}

GaineDexp*= this.Getexpmultiplier ();

GaineDexp*= this.getdiminishINGRETURNS (player);

GaineDexp*= Perkattributehelper.getorCreateMap (Player, SIDE) .Getmodifier (Player, Prog, PerkattribuTetypes.attr_inc_perk_effect)

GaineDexp*= Perkattributehelper.getorCreateMap (Player, SIDE) .Getmodifier (Player, Prog, PerkattribuTypes.attr_int_Perk_exp)

GaineDexp = Attributeevent.postProcessModed (Player, PerkattributeTypesa_Type_InC_PERK_EXP, GAINEDEXP); GainDexp)

ResearchManager.modifyExp (player, gaineDexp);

}

(All source code here-> hellfirepvp.astralsorcery.common.perk.node.root.rootevorsio.java)

The following part is relatively hard -core, and a certain programming skills are required to effectively understand. Please read it to avoid waste of time.

——Perkmodifier's additional control module-

Attentive readers should find that in the source code of each constellation, when the coefficient is finally calculated, there will always be two coefficients.

So what are these two coefficients?Why didn't I say?

This is because according to my research, this is a module about a modifier, which itself is very large. In addition, the author does not add annotations, so it is difficult for the author to understand it overall.

But what can be found out is that under the default conditions, the calculation results of these two coefficients will only be 1. Only when other modules modify the Perkmodifier module of their playersComplex calculations.

Once there is a value of more than 1 internally, it will basically produce more than double exponential growth based on multiple values.Slowly brush the times, and the other modules will certainly modify it, but if the modification is modified, it is estimated that only the author knows it himself.

The author here will no longer analyze it. Interested readers can go here to check the study-> hellfirepvp.astralsorcery.common.perk —?IntersectionIntersectionThe road that has never been conceived-

After knowing the decreasing multiplier, do you feel humiliated by this thing?

If your answer is, then congratulations, the author will provide you with a road that has never been conceived.

In the above, we already know that its punishment mechanism will actually be triggered only in the same milliseconds. If we can staggered the time of each experience, it is good.

So what do you do?In fact, each experience increase is set as an Event. It is necessary to take EventBus once, so if we can make EventBus congestion, can the Event isolation that increases the two experiences can achieve the effect we want?

That's right, as long as we block the game randomly, we can significantly avoid such punishment.

But how can we make random congestion?So, Keke, you know