tModLoader v2024.03
A mod to make and play Terraria mods
LeadingConditionRule Class Reference

A drop rule that doesn't drop any items by itself, rather it contains just a IItemDropRuleCondition. Use Chains.OnSuccess(IItemDropRule, IItemDropRule, bool), OnFailedConditions, or OnFailedRoll to attach other item drop rules to this rule. This can be useful for avoiding code repetition while writing logical item drop code. See the Chaining Rules section of the Basic NPC Drops and Loot Guidefor more information and examples. More...

Inherits IItemDropRule.

Public Member Functions

 LeadingConditionRule (IItemDropRuleCondition condition)
 
bool CanDrop (DropAttemptInfo info)
 
void ReportDroprates (List< DropRateInfo > drops, DropRateInfoChainFeed ratesInfo)
 
ItemDropAttemptResult TryDroppingItem (DropAttemptInfo info)
 
bool CanDrop (DropAttemptInfo info)
 
void ReportDroprates (List< DropRateInfo > drops, DropRateInfoChainFeed ratesInfo)
 
ItemDropAttemptResult TryDroppingItem (DropAttemptInfo info)
 

Public Attributes

IItemDropRuleCondition condition
 

Properties

List< IItemDropRuleChainAttemptChainedRules [get]
 
- Properties inherited from IItemDropRule
List< IItemDropRuleChainAttemptChainedRules [get]
 

Detailed Description

A drop rule that doesn't drop any items by itself, rather it contains just a IItemDropRuleCondition. Use Chains.OnSuccess(IItemDropRule, IItemDropRule, bool), OnFailedConditions, or OnFailedRoll to attach other item drop rules to this rule. This can be useful for avoiding code repetition while writing logical item drop code.

See the Chaining Rules section of the Basic NPC Drops and Loot Guide

for more information and examples.

Member Function Documentation

◆ CanDrop()

bool LeadingConditionRule.CanDrop ( DropAttemptInfo  info)

Implements IItemDropRule.

◆ ReportDroprates()

void LeadingConditionRule.ReportDroprates ( List< DropRateInfo drops,
DropRateInfoChainFeed  ratesInfo 
)

Implements IItemDropRule.

◆ TryDroppingItem()

ItemDropAttemptResult LeadingConditionRule.TryDroppingItem ( DropAttemptInfo  info)

Implements IItemDropRule.

Property Documentation

◆ ChainedRules

List<IItemDropRuleChainAttempt> LeadingConditionRule.ChainedRules
get

Implements IItemDropRule.