1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! Reputation management plugin for strategy, RPG, simulation, and social games
//!
//! # Overview
//!
//! ReputationPlugin provides generic reputation/score/rating management with:
//! - **Directional relationships**: Observer-target pairs (A's opinion of B ≠ B's opinion of A)
//! - **Multi-dimensional reputation**: Multiple categories per relationship (romance, friendship, etc.)
//! - **Thresholds**: Semantic levels (Hostile, Neutral, Friendly, etc.)
//! - **Hook-based customization**: Game-specific validation, modifiers, and callbacks
//! - **Event-driven**: Network-friendly state replication
//!
//! # Quick Start
//!
//! ```ignore
//! use issun::prelude::*;
//! use issun::plugin::reputation::{
//! ReputationPlugin, ReputationConfig, ReputationThreshold,
//! SubjectId, ReputationChangeRequested
//! };
//!
//! // Setup plugin
//! let game = GameBuilder::new()
//! .add_plugin(
//! ReputationPlugin::new()
//! .with_config(ReputationConfig {
//! default_score: 0.0,
//! score_range: Some((-100.0, 100.0)),
//! auto_clamp: true,
//! ..Default::default()
//! })
//! .add_threshold(ReputationThreshold::new("Hostile", -100.0, -50.0))
//! .add_threshold(ReputationThreshold::new("Neutral", -50.0, 50.0))
//! .add_threshold(ReputationThreshold::new("Friendly", 50.0, 100.0))
//! )
//! .build()
//! .await?;
//!
//! // Change reputation
//! let mut bus = resources.get_mut::<EventBus>().await.unwrap();
//! bus.publish(ReputationChangeRequested {
//! subject_id: SubjectId::new("player", "kingdom"),
//! delta: 15.0,
//! category: None,
//! reason: Some("Completed quest".into()),
//! });
//!
//! // Read reputation
//! let registry = resources.get::<ReputationRegistry>().await.unwrap();
//! if let Some(entry) = registry.get(&SubjectId::new("player", "kingdom")) {
//! println!("Reputation: {:.1}", entry.score);
//! if let Some(threshold) = registry.get_threshold(entry.score) {
//! println!("Status: {}", threshold.name);
//! }
//! }
//! ```
//!
//! # Use Cases
//!
//! - **Strategy games**: Diplomatic relations, faction trust scores
//! - **RPG**: NPC affinity, guild reputation, deity favor
//! - **Social/Dating sims**: Character relationship values, friendship levels
//! - **Roguelikes**: Karma systems, deity approval
//! - **City builders**: Citizen satisfaction, approval ratings
//! - **Card games**: Player rankings, ELO scores
//! - **Business sims**: Corporate reputation, brand loyalty
// Public exports
pub use ReputationConfig;
pub use ;
pub use ;
pub use ReputationPlugin;
pub use ReputationService;
pub use ReputationState;
pub use ReputationSystem;
pub use ;